Package org.glassfish.pfl.tf.timer.impl
Class VersionedHashSet<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<E>
-
- java.util.HashSet<E>
-
- 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
-
-
Field Summary
Fields Modifier and Type Field Description private long
version
-
Constructor Summary
Constructors Constructor Description VersionedHashSet()
VersionedHashSet(int initialCapacity)
VersionedHashSet(int initialCapacity, float loadFactor)
VersionedHashSet(java.util.Collection<? extends E> c)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(E e)
java.util.Iterator<E>
iterator()
boolean
remove(java.lang.Object o)
long
version()
-
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray, toString
-
-
-
-
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)
-
remove
public boolean remove(java.lang.Object o)
-
-