Top Inners Fields Constructors Methods
org.eclipse.persistence.internal.helper

public Class IdentityHashSet

extends AbstractCollection
implements Set, Cloneable, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, java.lang.Cloneable, java.util.Set, java.util.Collection, java.lang.Iterable
Imports
java.io.IOException, .ObjectInputStream, .ObjectOutputStream, .Serializable, java.util.AbstractCollection, .Collection, .ConcurrentModificationException, .Iterator, .NoSuchElementException, .Set

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
IdentityHashSet.Entry

IdentityHashSet entry.

pack-priv class

Field Summary

Modifier and TypeField and Description
protected transient int
pack-priv static final int
pack-priv static final float
private transient IdentityHashSet.Entry[]
protected float
pack-priv static final int
pack-priv static final long
protected int

Constructor Summary

AccessConstructor and Description
public
IdentityHashSet(int
the initial capacity of the IdentityHashSet.
initialCapacity
,
float
the loadFactor of the IdentityHashSet.
loadFactor
)

Constructs a new IdentityHashSet with the given initial capacity and the given loadFactor.

public
IdentityHashSet(int
the initial capacity of the IdentityHashSet.
initialCapacity
)

Constructs a new IdentityHashSet with the given initial capacity and a default loadFactor of 0.75.

public
IdentityHashSet()

Constructs a new IdentityHashSet with a default initial capacity of 32 and a loadfactor of 0.75.

public
IdentityHashSet(Collection<E>
the Collection whose contents are to be placed in the new IdentityHashSet.
c
)

Constructs a new IdentityHashSet with the same contents as the given Collection.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if this IdentityHashSet did not already contain obj.
add
(Object
object to add.
obj
)

Overrides java.util.AbstractCollection.add.

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

Adds the given object to this IdentityHashSet.
public void
clear()

Overrides java.util.AbstractCollection.clear.

Implements java.util.Set.clear, java.util.Collection.clear.

Removes all of the objects from this IdentityHashSet.
public Object

Returns:

a shallow copy of this IdentityHashSet.
clone
()

Overrides java.lang.Object.clone.

Returns a shallow copy of this IdentityHashSet (the elements are not cloned).
public boolean

Returns:

true if this IdentityHashSet contains obj by reference.
contains
(Object
the object to find.
obj
)

Overrides java.util.AbstractCollection.contains.

Implements java.util.Set.contains, java.util.Collection.contains.

Returns true if this IdentityHashSet contains the given object.
public boolean

Returns:

true if this IdentityHashSet is empty.
isEmpty
()

Overrides java.util.AbstractCollection.isEmpty.

Implements java.util.Set.isEmpty, java.util.Collection.isEmpty.

Returns true if this set contains no elements.
public Iterator<E>
iterator()

Implements abstract java.util.AbstractCollection.iterator.

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

Get an iterator for this IdentityHashSet
private void
readObject(ObjectInputStream s)

Deserialize the IdentityHashSet from a stream.

private void
rehash()

INTERNAL: Re-builds the internal array of Entry's with a larger capacity.

public boolean

Returns:

true if this IdentityHashSet contained obj.
remove
(Object
the object to be removed from this IdentityHashSet.
obj
)

Overrides java.util.AbstractCollection.remove.

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

Removes the given object from this IdentityHashSet, if present.
public boolean
removeAll(Collection<E>
collection containing elements to be removed from this set
c
)

Overrides java.util.AbstractCollection.removeAll.

Implements java.util.Set.removeAll, java.util.Collection.removeAll.

This implementation throws an UnsupportedOperationException because removeAll does not work correctly with reference equality testing.
public boolean
retainAll(Collection<E>
collection containing elements to be retained in this set
c
)

Overrides java.util.AbstractCollection.retainAll.

Implements java.util.Set.retainAll, java.util.Collection.retainAll.

This implementation throws an UnsupportedOperationException.
public int

Returns:

the size of this IdentityHashSet.
size
()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Set.size, java.util.Collection.size.

Returns the number of elements in this set (its cardinality).
private void
writeObject(ObjectOutputStream s)

Serialize the state of this IdentityHashSet to a stream.

Inherited from java.util.AbstractCollection:
addAllcontainsAlltoArraytoArraytoString

Field Detail

countback to summary
protected transient int count
DEFAULT_INITIAL_CAPACITYback to summary
pack-priv static final int DEFAULT_INITIAL_CAPACITY
DEFAULT_LOAD_FACTORback to summary
pack-priv static final float DEFAULT_LOAD_FACTOR
entriesback to summary
private transient IdentityHashSet.Entry[] entries
loadFactorback to summary
protected float loadFactor
MAXIMUM_CAPACITYback to summary
pack-priv static final int MAXIMUM_CAPACITY
serialVersionUIDback to summary
pack-priv static final long serialVersionUID
thresholdback to summary
protected int threshold

Constructor Detail

IdentityHashSetback to summary
public IdentityHashSet(int initialCapacity, float loadFactor)

Constructs a new IdentityHashSet with the given initial capacity and the given loadFactor.

Parameters
initialCapacity:int

the initial capacity of the IdentityHashSet.

loadFactor:float

the loadFactor of the IdentityHashSet.

Exceptions
IllegalArgumentException:
if the initial capacity is less than zero, or if the loadFactor is nonpositive.
IdentityHashSetback to summary
public IdentityHashSet(int initialCapacity)

Constructs a new IdentityHashSet with the given initial capacity and a default loadFactor of 0.75.

Parameters
initialCapacity:int

the initial capacity of the IdentityHashSet.

Exceptions
IllegalArgumentException:
if the initial capacity is less than zero.
IdentityHashSetback to summary
public IdentityHashSet()

Constructs a new IdentityHashSet with a default initial capacity of 32 and a loadfactor of 0.75.

IdentityHashSetback to summary
public IdentityHashSet(Collection<E> c)

Constructs a new IdentityHashSet with the same contents as the given Collection. The new IdentityHashSet is created with an initial capacity sufficient to hold the elements of the given Collection.

Parameters
c:Collection<E>

the Collection whose contents are to be placed in the new IdentityHashSet.

Method Detail

addback to summary
public boolean add(Object obj)

Overrides java.util.AbstractCollection.add.

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

Adds the given object to this IdentityHashSet.

Parameters
obj:Object

object to add.

Returns:boolean

true if this IdentityHashSet did not already contain obj.

Annotations
@Override
Exceptions
NullPointerException:
if obj is null.
clearback to summary
public void clear()

Overrides java.util.AbstractCollection.clear.

Implements java.util.Set.clear, java.util.Collection.clear.

Removes all of the objects from this IdentityHashSet.

Annotations
@Override
cloneback to summary
public Object clone()

Overrides java.lang.Object.clone.

Returns a shallow copy of this IdentityHashSet (the elements are not cloned).

Returns:Object

a shallow copy of this IdentityHashSet.

Annotations
@Override
containsback to summary
public boolean contains(Object obj)

Overrides java.util.AbstractCollection.contains.

Implements java.util.Set.contains, java.util.Collection.contains.

Returns true if this IdentityHashSet contains the given object.

Parameters
obj:Object

the object to find.

Returns:boolean

true if this IdentityHashSet contains obj by reference.

Annotations
@Override
isEmptyback to summary
public boolean isEmpty()

Overrides java.util.AbstractCollection.isEmpty.

Implements java.util.Set.isEmpty, java.util.Collection.isEmpty.

Doc from java.util.Set.isEmpty.

Returns true if this set contains no elements.

Returns:boolean

true if this IdentityHashSet is empty.

Annotations
@Override
iteratorback to summary
public Iterator<E> iterator()

Implements abstract java.util.AbstractCollection.iterator.

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

Get an iterator for this IdentityHashSet

Returns:Iterator<E>

Doc from java.util.Set.iterator.

an iterator over the elements in this set

Annotations
@Override
readObjectback to summary
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException

Deserialize the IdentityHashSet from a stream.

rehashback to summary
private void rehash()

INTERNAL: Re-builds the internal array of Entry's with a larger capacity. This method is called automatically when the number of objects in this IdentityHashSet exceeds its current threshold.

removeback to summary
public boolean remove(Object obj)

Overrides java.util.AbstractCollection.remove.

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

Removes the given object from this IdentityHashSet, if present.

Parameters
obj:Object

the object to be removed from this IdentityHashSet.

Returns:boolean

true if this IdentityHashSet contained obj.

Annotations
@Override
removeAllback to summary
public boolean removeAll(Collection<E> c)

Overrides java.util.AbstractCollection.removeAll.

Implements java.util.Set.removeAll, java.util.Collection.removeAll.

This implementation throws an UnsupportedOperationException because removeAll does not work correctly with reference equality testing.

Parameters
c:Collection<E>

Doc from java.util.Set.removeAll.

collection containing elements to be removed from this set

Returns:boolean

Doc from java.util.Set.removeAll.

true if this set changed as a result of the call

Annotations
@Override
retainAllback to summary
public boolean retainAll(Collection<E> c)

Overrides java.util.AbstractCollection.retainAll.

Implements java.util.Set.retainAll, java.util.Collection.retainAll.

This implementation throws an UnsupportedOperationException. The Javadocs for AbstractCollection indicates that retainAll is an optional method.

Parameters
c:Collection<E>

Doc from java.util.Set.retainAll.

collection containing elements to be retained in this set

Returns:boolean

Doc from java.util.Set.retainAll.

true if this set changed as a result of the call

Annotations
@Override
sizeback to summary
public int size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Set.size, java.util.Collection.size.

Doc from java.util.Set.size.

Returns the number of elements in this set (its cardinality). If this set contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Returns:int

the size of this IdentityHashSet.

Annotations
@Override
writeObjectback to summary
private void writeObject(ObjectOutputStream s) throws IOException, ClassNotFoundException

Serialize the state of this IdentityHashSet to a stream.

Serial data
The capacity of the IdentityHashSet (the length of the bucket array) is emitted (int), followed by the size of the IdentityHashSet, followed by the contents (in no particular order).
org.eclipse.persistence.internal.helper back to summary

private Class IdentityHashSet.Entry

extends Object
Class Inheritance
  • java.lang.Object
  • org.eclipse.persistence.internal.helper.IdentityHashSet.Entry

IdentityHashSet entry.

Field Summary

Modifier and TypeField and Description
pack-priv int
pack-priv IdentityHashSet.Entry
pack-priv Object

Constructor Summary

AccessConstructor and Description
pack-priv
Entry(int hash, Object value, IdentityHashSet.Entry next)

Method Summary

Modifier and TypeMethod and Description
protected Object
clone()

Overrides java.lang.Object.clone.

Creates and returns a copy of this object.
Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

hashback to summary
pack-priv int hash
nextback to summary
pack-priv IdentityHashSet.Entry next
valueback to summary
pack-priv Object value

Constructor Detail

Entryback to summary
pack-priv Entry(int hash, Object value, IdentityHashSet.Entry next)

Method Detail

cloneback to summary
protected Object clone()

Overrides java.lang.Object.clone.

Doc from java.lang.Object.clone.

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

Returns:Object

a clone of this instance.

Annotations
@Override
org.eclipse.persistence.internal.helper back to summary

pack-priv Class IdentityHashSet.IdentityHashSetIterator

extends Object
implements Iterator
Class Inheritance
  • java.lang.Object
  • org.eclipse.persistence.internal.helper.IdentityHashSet.IdentityHashSetIterator
All Implemented Interfaces
java.util.Iterator

Field Summary

Modifier and TypeField and Description
pack-priv IdentityHashSet.Entry[]
pack-priv IdentityHashSet.Entry
pack-priv int
pack-priv IdentityHashSet.Entry

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.
public Object
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.
public void
remove()

Overrides default java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation).
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

copyOfEntriesback to summary
pack-priv IdentityHashSet.Entry[] copyOfEntries
entryback to summary
pack-priv IdentityHashSet.Entry entry
indexback to summary
pack-priv int index
lastReturnedback to summary
pack-priv IdentityHashSet.Entry lastReturned

Constructor Detail

IdentityHashSetIteratorback to summary
pack-priv IdentityHashSetIterator()

Method Detail

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the iteration has more elements

Annotations
@Override
nextback to summary
public Object next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:Object

the next element in the iteration

Annotations
@Override
removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Doc from java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to next.

The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.

The behavior of an iterator is unspecified if this method is called after a call to the forEachRemaining method.

Annotations
@Override