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:
java.io.Serializable
,java.lang.Iterable<V>
,java.util.Collection<V>
,java.util.Set<V>
public class LifoSet<V> extends java.util.AbstractSet<V> implements java.io.Serializable
LifoSet - Set interface wrapper around a LinkedList- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description LifoSet()
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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(V obj)
boolean
empty()
java.util.Iterator<V>
iterator()
V
peek()
V
pop()
void
push(V item)
int
search(java.lang.Object item)
void
setCapactity(int capacity)
Sets the max capacity for this LifoSetint
size()
-
Methods inherited from class java.util.AbstractCollection
addAll, clear, contains, containsAll, isEmpty, remove, retainAll, toArray, toArray, toString
-
-
-
-
Constructor Detail
-
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 Detail
-
setCapactity
public void setCapactity(int capacity)
Sets the max capacity for this LifoSet- Parameters:
capacity
- Max Size (as integer)
-
size
public int size()
-
add
public boolean add(V obj)
-
iterator
public java.util.Iterator<V> iterator()
-
empty
public boolean empty()
- Returns:
- true if and only if this stack contains no items; false otherwise
- See Also:
Stack.empty()
-
push
public void push(V item)
- Parameters:
item
- The item to be pushed onto this stack- See Also:
Stack.push(java.lang.Object)
-
pop
public V pop() throws java.util.EmptyStackException
- Returns:
- The object at the top of this stack
- Throws:
java.util.EmptyStackException
- If this stack is empty- See Also:
Stack.pop()
-
peek
public V peek() throws java.util.EmptyStackException
- Returns:
- The object at the top of this stack
- Throws:
java.util.EmptyStackException
- If this stack is empty- See Also:
Stack.peek()
-
search
public int search(java.lang.Object item)
- 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:
Stack.search(java.lang.Object)
-
-