Class LifoSet<V>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<V>
org.apache.ofbiz.base.util.collections.LifoSet<V>
- All Implemented Interfaces:
Serializable
,Iterable<V>
,Collection<V>
,Set<V>
LifoSet - Set interface wrapper around a LinkedList
- See Also:
-
Constructor Summary
ConstructorDescriptionLifoSet()
Constructs a set containing the elements of the specified collection, in the order they are returned by the collection's iterator.LifoSet
(int capacity) Constructs a set containing the elements of the specified collection, in the order they are returned by the collection's iterator. -
Method Summary
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
Methods inherited from class java.util.AbstractCollection
addAll, clear, contains, containsAll, isEmpty, remove, retainAll, toArray, toArray, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Constructor Details
-
LifoSet
public LifoSet()Constructs a set containing the elements of the specified collection, in the order they are returned by the collection's iterator. -
LifoSet
public LifoSet(int capacity) Constructs a set containing the elements of the specified collection, in the order they are returned by the collection's iterator.- Parameters:
capacity
- the collection whose elements are to be placed into this set.
-
-
Method Details
-
setCapactity
public void setCapactity(int capacity) Sets the max capacity for this LifoSet- Parameters:
capacity
- Max Size (as integer)
-
size
public int size()- Specified by:
size
in interfaceCollection<V>
- Specified by:
size
in interfaceSet<V>
- Specified by:
size
in classAbstractCollection<V>
- See Also:
-
add
- Specified by:
add
in interfaceCollection<V>
- Specified by:
add
in interfaceSet<V>
- Overrides:
add
in classAbstractCollection<V>
- See Also:
-
iterator
-
empty
public boolean empty()- Returns:
- true if and only if this stack contains no items; false otherwise
- See Also:
-
push
- Parameters:
item
- The item to be pushed onto this stack- See Also:
-
pop
- Returns:
- The object at the top of this stack
- Throws:
EmptyStackException
- If this stack is empty- See Also:
-
peek
- Returns:
- The object at the top of this stack
- Throws:
EmptyStackException
- If this stack is empty- See Also:
-
search
- Parameters:
item
- The desired object- Returns:
- The 1-based position from the top of the stack where the object is located; the return value -1 indicates that the object is not on the stack
- See Also:
-