org.glassfish.pfl.tf.timer.impl
Class VersionedHashSet<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<E>
          extended by java.util.HashSet<E>
              extended by org.glassfish.pfl.tf.timer.impl.VersionedHashSet<E>
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<E>, java.util.Collection<E>, java.util.Set<E>

public class VersionedHashSet<E>
extends java.util.HashSet<E>

This is an implementation of the Set interface that keeps track of its version so that we can tell when it is modified. Each time an element is added to or removed from the set, the version is incremented. This implementation is synchronized so that the version is consistently updated whenever the set is modified.

See Also:
Serialized Form

Constructor Summary
VersionedHashSet()
           
VersionedHashSet(java.util.Collection<? extends E> c)
           
VersionedHashSet(int initialCapacity)
           
VersionedHashSet(int initialCapacity, float loadFactor)
           
 
Method Summary
 boolean add(E e)
           
 java.util.Iterator<E> iterator()
           
 boolean remove(java.lang.Object o)
           
 long version()
           
 
Methods inherited from class java.util.HashSet
clear, clone, contains, isEmpty, size
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
addAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray
 

Constructor Detail

VersionedHashSet

public VersionedHashSet()

VersionedHashSet

public VersionedHashSet(java.util.Collection<? extends E> c)

VersionedHashSet

public VersionedHashSet(int initialCapacity,
                        float loadFactor)

VersionedHashSet

public VersionedHashSet(int initialCapacity)
Method Detail

version

public long version()

add

public boolean add(E e)
Specified by:
add in interface java.util.Collection<E>
Specified by:
add in interface java.util.Set<E>
Overrides:
add in class java.util.HashSet<E>

remove

public boolean remove(java.lang.Object o)
Specified by:
remove in interface java.util.Collection<E>
Specified by:
remove in interface java.util.Set<E>
Overrides:
remove in class java.util.HashSet<E>

iterator

public java.util.Iterator<E> iterator()
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>
Overrides:
iterator in class java.util.HashSet<E>