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:
Serializable
,Cloneable
,Iterable<E>
,Collection<E>
,Set<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:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionVersionedHashSet
(int initialCapacity) VersionedHashSet
(int initialCapacity, float loadFactor) VersionedHashSet
(Collection<? extends E> c) -
Method Summary
Methods inherited from class java.util.HashSet
clear, clone, contains, isEmpty, newHashSet, size, spliterator, toArray, toArray
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Field Details
-
version
private long version
-
-
Constructor Details
-
VersionedHashSet
public VersionedHashSet() -
VersionedHashSet
-
VersionedHashSet
public VersionedHashSet(int initialCapacity, float loadFactor) -
VersionedHashSet
public VersionedHashSet(int initialCapacity)
-
-
Method Details
-
version
public long version() -
add
-
remove
-
iterator
-