Package org.zkoss.util
Class IdentityHashSet<T>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<T>
org.zkoss.util.IdentityHashSet<T>
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<T>,Collection<T>,Set<T>
Like java.util.InternalHashMap, it uses == and System.identityHashCode
for doing HashSet.
- Author:
- tomyeh
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new, empty set; the backing IdentityHashMap instance has default capacity (32).IdentityHashSet(int expectedMaxSize) Constructs a new, empty set with the specified expected maximum size.Constructs a new set containing the elements in the specified collection. -
Method Summary
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAllMethods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Set
addAll, containsAll, equals, hashCode, removeAll, retainAll, spliterator, toArray, toArray
-
Constructor Details
-
IdentityHashSet
public IdentityHashSet()Constructs a new, empty set; the backing IdentityHashMap instance has default capacity (32). -
IdentityHashSet
Constructs a new set containing the elements in the specified collection.- Parameters:
c- the collection whose elements are to be placed into this set.- Throws:
NullPointerException- if the specified collection is null.
-
IdentityHashSet
public IdentityHashSet(int expectedMaxSize) Constructs a new, empty set with the specified expected maximum size.- Parameters:
expectedMaxSize- the expected maximum size of the map.- Throws:
IllegalArgumentException- if expectedMaxSize is negative
-
-
Method Details
-
iterator
-
size
public int size()- Specified by:
sizein interfaceCollection<T>- Specified by:
sizein interfaceSet<T>- Specified by:
sizein classAbstractCollection<T>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCollection<T>- Specified by:
isEmptyin interfaceSet<T>- Overrides:
isEmptyin classAbstractCollection<T>
-
contains
- Specified by:
containsin interfaceCollection<T>- Specified by:
containsin interfaceSet<T>- Overrides:
containsin classAbstractCollection<T>
-
add
- Specified by:
addin interfaceCollection<T>- Specified by:
addin interfaceSet<T>- Overrides:
addin classAbstractCollection<T>
-
remove
- Specified by:
removein interfaceCollection<T>- Specified by:
removein interfaceSet<T>- Overrides:
removein classAbstractCollection<T>
-
clear
public void clear()- Specified by:
clearin interfaceCollection<T>- Specified by:
clearin interfaceSet<T>- Overrides:
clearin classAbstractCollection<T>
-
clone
-