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:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Iterable<T>
,java.util.Collection<T>
,java.util.Set<T>
public class IdentityHashSet<T> extends java.util.AbstractSet<T> implements java.util.Set<T>, java.lang.Cloneable, java.io.Serializable
Like java.util.InternalHashMap, it uses == and System.identityHashCode for doing HashSet.- Author:
- tomyeh
- See Also:
IdentityComparator
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description IdentityHashSet()
Constructs 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.IdentityHashSet(java.util.Collection<T> c)
Constructs a new set containing the elements in the specified collection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(T o)
void
clear()
java.lang.Object
clone()
boolean
contains(java.lang.Object o)
boolean
isEmpty()
java.util.Iterator<T>
iterator()
boolean
remove(java.lang.Object o)
int
size()
-
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray, toString
-
-
-
-
Constructor Detail
-
IdentityHashSet
public IdentityHashSet()
Constructs a new, empty set; the backing IdentityHashMap instance has default capacity (32).
-
IdentityHashSet
public IdentityHashSet(java.util.Collection<T> c)
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:
java.lang.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:
java.lang.IllegalArgumentException
- if expectedMaxSize is negative
-
-
Method Detail
-
iterator
public java.util.Iterator<T> iterator()
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
contains
public boolean contains(java.lang.Object o)
-
add
public boolean add(T o)
-
remove
public boolean remove(java.lang.Object o)
-
clear
public void clear()
-
clone
public java.lang.Object clone()
- Overrides:
clone
in classjava.lang.Object
-
-