org.jopendocument.util.cc
Class IdentityHashSet<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
org.jopendocument.util.cc.IdentityHashSet<E>
- Type Parameters:
E - the type of elements maintained by this set
- All Implemented Interfaces:
- java.lang.Cloneable, java.lang.Iterable<E>, java.util.Collection<E>, java.util.Set<E>, IdentitySet<E>
public final class IdentityHashSet<E>
- extends java.util.AbstractSet<E>
- implements IdentitySet<E>, java.lang.Cloneable
This class implements the Set interface with a hash table, using reference-equality in
place of object-equality when comparing items. In other words, in an IdentityHashSet,
two keys k1 and k2 are considered equal if and only if (k1==k2). (In
normal Set implementations (like HashSet) two keys k1 and k2
are considered equal if and only if (k1==null ? k2==null : k1.equals(k2)).)
|
Method Summary |
boolean |
add(E e)
|
boolean |
addAll(java.util.Collection<? extends E> c)
|
void |
clear()
|
java.lang.Object |
clone()
Returns a shallow copy of this HashSet instance: the elements themselves are not
cloned. |
boolean |
contains(java.lang.Object o)
|
boolean |
containsAll(java.util.Collection<?> c)
|
boolean |
isEmpty()
|
java.util.Iterator<E> |
iterator()
|
boolean |
remove(java.lang.Object o)
|
boolean |
removeAll(java.util.Collection<?> c)
|
boolean |
retainAll(java.util.Collection<?> c)
|
int |
size()
|
java.lang.Object[] |
toArray()
|
|
toArray(T[] a)
|
| Methods inherited from class java.util.AbstractSet |
equals, hashCode |
| Methods inherited from class java.util.AbstractCollection |
toString |
| Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Set |
equals, hashCode |
IdentityHashSet
public IdentityHashSet()
IdentityHashSet
public IdentityHashSet(int expectedMaxSize)
IdentityHashSet
public IdentityHashSet(java.util.Collection<? extends E> c)
add
public boolean add(E e)
- Specified by:
add in interface java.util.Collection<E>- Specified by:
add in interface java.util.Set<E>- Overrides:
add in class java.util.AbstractCollection<E>
addAll
public boolean addAll(java.util.Collection<? extends E> c)
- Specified by:
addAll in interface java.util.Collection<E>- Specified by:
addAll in interface java.util.Set<E>- Overrides:
addAll in class java.util.AbstractCollection<E>
clear
public void clear()
- Specified by:
clear in interface java.util.Collection<E>- Specified by:
clear in interface java.util.Set<E>- Overrides:
clear in class java.util.AbstractCollection<E>
size
public int size()
- Specified by:
size in interface java.util.Collection<E>- Specified by:
size in interface java.util.Set<E>- Specified by:
size in class java.util.AbstractCollection<E>
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty in interface java.util.Collection<E>- Specified by:
isEmpty in interface java.util.Set<E>- Overrides:
isEmpty in class java.util.AbstractCollection<E>
iterator
public java.util.Iterator<E> iterator()
- Specified by:
iterator in interface java.lang.Iterable<E>- Specified by:
iterator in interface java.util.Collection<E>- Specified by:
iterator in interface java.util.Set<E>- Specified by:
iterator in class java.util.AbstractCollection<E>
contains
public boolean contains(java.lang.Object o)
- Specified by:
contains in interface java.util.Collection<E>- Specified by:
contains in interface java.util.Set<E>- Overrides:
contains in class java.util.AbstractCollection<E>
containsAll
public boolean containsAll(java.util.Collection<?> c)
- Specified by:
containsAll in interface java.util.Collection<E>- Specified by:
containsAll in interface java.util.Set<E>- Overrides:
containsAll in class java.util.AbstractCollection<E>
remove
public boolean remove(java.lang.Object o)
- Specified by:
remove in interface java.util.Collection<E>- Specified by:
remove in interface java.util.Set<E>- Overrides:
remove in class java.util.AbstractCollection<E>
removeAll
public boolean removeAll(java.util.Collection<?> c)
- Specified by:
removeAll in interface java.util.Collection<E>- Specified by:
removeAll in interface java.util.Set<E>- Overrides:
removeAll in class java.util.AbstractSet<E>
retainAll
public boolean retainAll(java.util.Collection<?> c)
- Specified by:
retainAll in interface java.util.Collection<E>- Specified by:
retainAll in interface java.util.Set<E>- Overrides:
retainAll in class java.util.AbstractCollection<E>
toArray
public java.lang.Object[] toArray()
- Specified by:
toArray in interface java.util.Collection<E>- Specified by:
toArray in interface java.util.Set<E>- Overrides:
toArray in class java.util.AbstractCollection<E>
toArray
public <T> T[] toArray(T[] a)
- Specified by:
toArray in interface java.util.Collection<E>- Specified by:
toArray in interface java.util.Set<E>- Overrides:
toArray in class java.util.AbstractCollection<E>
clone
public java.lang.Object clone()
- Returns a shallow copy of this HashSet instance: the elements themselves are not
cloned.
- Overrides:
clone in class java.lang.Object
- Returns:
- a shallow copy of this set