public class IdentityHashSet extends AbstractCollection implements Set, Cloneable, Serializable
Constructor and Description |
---|
IdentityHashSet()
Constructs a new IdentityHashSet with a default initial
capacity of 32 and a loadfactor of 0.75.
|
IdentityHashSet(Collection c)
Constructs a new IdentityHashSet with the same contents
as the given Collection.
|
IdentityHashSet(int initialCapacity)
Constructs a new IdentityHashSet with the given
initial capacity and a default loadFactor of 0.75.
|
IdentityHashSet(int initialCapacity,
float loadFactor)
Constructs a new IdentityHashSet with the given initial
capacity and the given loadFactor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(Object obj)
Adds the given object to this IdentityHashSet.
|
void |
clear()
Removes all of the objects from this IdentityHashSet.
|
Object |
clone()
Returns a shallow copy of this IdentityHashSet (the
elements are not cloned).
|
boolean |
contains(Object obj)
Returns true if this IdentityHashSet contains
the given object.
|
boolean |
isEmpty() |
Iterator |
iterator()
Get an iterator for this IdentityHashSet
|
boolean |
remove(Object obj)
Removes the given object from this IdentityHashSet, if
present.
|
boolean |
removeAll(Collection c)
This implementation throws an UnsupportedOperationException
because removeAll does not work correctly with reference
equality testing.
|
boolean |
retainAll(Collection c)
This implementation throws an UnsupportedOperationException.
|
int |
size() |
addAll, containsAll, toArray, toArray, toString
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
addAll, containsAll, equals, hashCode, spliterator, toArray, toArray
parallelStream, removeIf, stream
public IdentityHashSet(int initialCapacity, float loadFactor)
initialCapacity
- the initial capacity of the
IdentityHashSet.loadFactor
- the loadFactor of the IdentityHashSet.IllegalArgumentException
- if the initial capacity is less
than zero, or if the loadFactor is nonpositive.public IdentityHashSet(int initialCapacity)
initialCapacity
- the initial capacity of the IdentityHashSet.IllegalArgumentException
- if the initial capacity is less
than zero.public IdentityHashSet()
public IdentityHashSet(Collection c)
c
- the Collection whose contents are to be placed in the
new IdentityHashSet.public int size()
size
in interface Collection
size
in interface Set
size
in class AbstractCollection
public boolean isEmpty()
isEmpty
in interface Collection
isEmpty
in interface Set
isEmpty
in class AbstractCollection
public boolean contains(Object obj)
contains
in interface Collection
contains
in interface Set
contains
in class AbstractCollection
obj
- the object to find.public boolean add(Object obj)
add
in interface Collection
add
in interface Set
add
in class AbstractCollection
obj
- object to add.NullPointerException
- if obj is null.public boolean remove(Object obj)
remove
in interface Collection
remove
in interface Set
remove
in class AbstractCollection
obj
- the object to be removed from this IdentityHashSet.public boolean removeAll(Collection c)
removeAll
in interface Collection
removeAll
in interface Set
removeAll
in class AbstractCollection
public boolean retainAll(Collection c)
AbstractCollection
indicates that retainAll
is an optional method.retainAll
in interface Collection
retainAll
in interface Set
retainAll
in class AbstractCollection
public void clear()
clear
in interface Collection
clear
in interface Set
clear
in class AbstractCollection
public Object clone()
public Iterator iterator()
iterator
in interface Iterable
iterator
in interface Collection
iterator
in interface Set
iterator
in class AbstractCollection
EclipseLink 2.6.3, "build v20160428-59c81c5" API Reference