|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ISock<T>
Subset of java.util.Collection plus a peek() from java.util.Stack
Method Summary | |
---|---|
boolean |
add(T o)
The same as add(T o, false). |
boolean |
add(T o,
boolean replace)
Ensures that this collection contains the specified element (optional operation). |
java.util.Iterator<ISockEntry<T>> |
entryIterator()
Return an iterator of the sock entries in this sock. |
ISockEntry<T> |
entryPeek()
Return the most recent ISockEntry in this sock. |
boolean |
isEmpty()
Returns true if this collection contains no elements. |
java.util.Iterator<T> |
iterator()
Returns an iterator over the elements in this collection. |
T |
peek()
Looks at the most recent object in this sock. |
int |
size()
Returns the number of elements in this collection. |
Method Detail |
---|
int size()
boolean isEmpty()
java.util.Iterator<T> iterator()
iterator
in interface java.lang.Iterable<T>
boolean add(T o)
o
- element whose presence in this collection is to be ensured.
java.lang.UnsupportedOperationException
- add is not supported by this collection.
java.lang.ClassCastException
- class of the specified element prevents it from being added
to this collection.
java.lang.NullPointerException
- if the specified element is null and this collection does not
support null elements.
java.lang.IllegalArgumentException
- some aspect of this element prevents it from being added to
this collection.boolean add(T o, boolean replace)
Collections that support this operation may place limitations on what elements may be added to this collection. In particular, some collections will refuse to add null elements, and others will impose restrictions on the type of elements that may be added. Collection classes should clearly specify in their documentation any restrictions on what elements may be added.
If a collection refuses to add a particular element for any reason other than that it already contains the element, it must throw an exception (rather than returning false). This preserves the invariant that a collection always contains the specified element after this call returns.
o
- element whose presence in this collection is to be ensured.replace
- false -- creates and adds a new SockEntry for this object
true -- replaces the timestamp and value of the most recent
SockEntry with the current timestamp and this object
java.lang.UnsupportedOperationException
- add is not supported by this collection.
java.lang.ClassCastException
- class of the specified element prevents it from being added
to this collection.
java.lang.NullPointerException
- if the specified element is null and this collection does not
support null elements.
java.lang.IllegalArgumentException
- some aspect of this element prevents it from being added to
this collection.T peek()
java.util.EmptyStackException
- if this sock is empty.ISockEntry<T> entryPeek()
java.util.Iterator<ISockEntry<T>> entryIterator()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |