com.caucho.util
Class LifoSet<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<E>
          extended by com.caucho.util.LifoSet<E>
All Implemented Interfaces:
java.lang.Iterable<E>, java.util.Collection<E>, java.util.Set<E>

public class LifoSet<E>
extends java.util.AbstractSet<E>

Stack (lifo) ordered set, used by the JCA code so recent connections are used first.


Constructor Summary
LifoSet()
           
 
Method Summary
 boolean add(E o)
          Adds an element.
 void clear()
          Clears the set.
 boolean contains(java.lang.Object o)
          Returns true if the item is in the set.
 boolean containsAll(java.util.Collection<?> c)
          Returns true if the item is in the set.
 boolean equals(java.lang.Object o)
          Test for equality
 int hashCode()
          Returns the hash code.
 boolean isEmpty()
          Returns true if empty.
 java.util.Iterator<E> iterator()
          Returns an iterator to the set.
 boolean remove(java.lang.Object o)
          Removes an element of the set.
 boolean removeAll(java.util.Collection<?> c)
          Removes an element of the set.
 boolean retainAll(java.util.Collection<?> c)
          Removes an element of the set.
 int size()
          Returns the number of elements in the set.
 java.lang.Object[] toArray()
          Returns an array of the elements in the set.
<T> T[]
toArray(T[] a)
          Returns an array of the elements in the set.
 
Methods inherited from class java.util.AbstractCollection
addAll, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
addAll
 

Constructor Detail

LifoSet

public LifoSet()
Method Detail

size

public int size()
Returns the number of elements in the set.

Specified by:
size in interface java.util.Collection<E>
Specified by:
size in interface java.util.Set<E>
Specified by:
size in class java.util.AbstractCollection<E>

isEmpty

public boolean isEmpty()
Returns true if empty.

Specified by:
isEmpty in interface java.util.Collection<E>
Specified by:
isEmpty in interface java.util.Set<E>
Overrides:
isEmpty in class java.util.AbstractCollection<E>

add

public boolean add(E o)
Adds an element.

Specified by:
add in interface java.util.Collection<E>
Specified by:
add in interface java.util.Set<E>
Overrides:
add in class java.util.AbstractCollection<E>

clear

public void clear()
Clears the set.

Specified by:
clear in interface java.util.Collection<E>
Specified by:
clear in interface java.util.Set<E>
Overrides:
clear in class java.util.AbstractCollection<E>

contains

public boolean contains(java.lang.Object o)
Returns true if the item is in the set.

Specified by:
contains in interface java.util.Collection<E>
Specified by:
contains in interface java.util.Set<E>
Overrides:
contains in class java.util.AbstractCollection<E>

containsAll

public boolean containsAll(java.util.Collection<?> c)
Returns true if the item is in the set.

Specified by:
containsAll in interface java.util.Collection<E>
Specified by:
containsAll in interface java.util.Set<E>
Overrides:
containsAll in class java.util.AbstractCollection<E>

iterator

public java.util.Iterator<E> iterator()
Returns an iterator to the set.

Specified by:
iterator in interface java.lang.Iterable<E>
Specified by:
iterator in interface java.util.Collection<E>
Specified by:
iterator in interface java.util.Set<E>
Specified by:
iterator in class java.util.AbstractCollection<E>

remove

public boolean remove(java.lang.Object o)
Removes an element of the set.

Specified by:
remove in interface java.util.Collection<E>
Specified by:
remove in interface java.util.Set<E>
Overrides:
remove in class java.util.AbstractCollection<E>

removeAll

public boolean removeAll(java.util.Collection<?> c)
Removes an element of the set.

Specified by:
removeAll in interface java.util.Collection<E>
Specified by:
removeAll in interface java.util.Set<E>
Overrides:
removeAll in class java.util.AbstractSet<E>

retainAll

public boolean retainAll(java.util.Collection<?> c)
Removes an element of the set.

Specified by:
retainAll in interface java.util.Collection<E>
Specified by:
retainAll in interface java.util.Set<E>
Overrides:
retainAll in class java.util.AbstractCollection<E>

toArray

public java.lang.Object[] toArray()
Returns an array of the elements in the set.

Specified by:
toArray in interface java.util.Collection<E>
Specified by:
toArray in interface java.util.Set<E>
Overrides:
toArray in class java.util.AbstractCollection<E>

toArray

public <T> T[] toArray(T[] a)
Returns an array of the elements in the set.

Specified by:
toArray in interface java.util.Collection<E>
Specified by:
toArray in interface java.util.Set<E>
Overrides:
toArray in class java.util.AbstractCollection<E>

hashCode

public int hashCode()
Returns the hash code.

Specified by:
hashCode in interface java.util.Collection<E>
Specified by:
hashCode in interface java.util.Set<E>
Overrides:
hashCode in class java.util.AbstractSet<E>

equals

public boolean equals(java.lang.Object o)
Test for equality

Specified by:
equals in interface java.util.Collection<E>
Specified by:
equals in interface java.util.Set<E>
Overrides:
equals in class java.util.AbstractSet<E>