Top Description Fields Constructors Methods
org.glassfish.pfl.tf.timer.impl

public Class VersionedHashSet<E>

extends HashSet<E>
Class Inheritance
Imports
java.util.Collection, .HashSet, .Iterator

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.

Field Summary

Modifier and TypeField and Description
private long

Constructor Summary

AccessConstructor and Description
public
public
VersionedHashSet(Collection<? extends E> c)

public
VersionedHashSet(int initialCapacity, float loadFactor)

public
VersionedHashSet(int initialCapacity)

Method Summary

Modifier and TypeMethod and Description
public synchronized boolean
add(E e)

Overrides java.util.HashSet.add.

Implements java.util.Set.add, java.util.Collection.add.

Adds the specified element to this set if it is not already present.

public Iterator<E>
iterator()

Overrides java.util.HashSet.iterator.

Implements java.util.Set.iterator, java.util.Collection.iterator.

Returns an iterator over the elements in this set.

public synchronized boolean
remove(Object o)

Overrides java.util.HashSet.remove.

Implements java.util.Set.remove, java.util.Collection.remove.

Removes the specified element from this set if it is present.

public synchronized long
Inherited from java.util.HashSet:
clearclonecontainsisEmptynewHashSetsizespliteratortoArraytoArray

Field Detail

versionback to summary
private long version

Constructor Detail

VersionedHashSetback to summary
public VersionedHashSet()
VersionedHashSetback to summary
public VersionedHashSet(Collection<? extends E> c)
VersionedHashSetback to summary
public VersionedHashSet(int initialCapacity, float loadFactor)
VersionedHashSetback to summary
public VersionedHashSet(int initialCapacity)

Method Detail

addback to summary
public synchronized boolean add(E e)

Overrides java.util.HashSet.add.

Implements java.util.Set.add, java.util.Collection.add.

Doc from java.util.HashSet.add.

Adds the specified element to this set if it is not already present. More formally, adds the specified element e to this set if this set contains no element e2 such that Objects.equals(e, e2). If this set already contains the element, the call leaves the set unchanged and returns false.

iteratorback to summary
public Iterator<E> iterator()

Overrides java.util.HashSet.iterator.

Implements java.util.Set.iterator, java.util.Collection.iterator.

Doc from java.util.HashSet.iterator.

Returns an iterator over the elements in this set. The elements are returned in no particular order.

removeback to summary
public synchronized boolean remove(Object o)

Overrides java.util.HashSet.remove.

Implements java.util.Set.remove, java.util.Collection.remove.

Doc from java.util.HashSet.remove.

Removes the specified element from this set if it is present. More formally, removes an element e such that Objects.equals(o, e), if this set contains such an element. Returns true if this set contained the element (or equivalently, if this set changed as a result of the call). (This set will not contain the element once the call returns.)

versionback to summary
public synchronized long version()