Package net.ontopia.utils
Class CompactIdentityHashSet<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<E>
-
- net.ontopia.utils.CompactHashSet<E>
-
- net.ontopia.utils.CompactIdentityHashSet<E>
-
- All Implemented Interfaces:
Iterable<E>,Collection<E>,Set<E>
public class CompactIdentityHashSet<E> extends CompactHashSet<E>
INTERNAL: This class is a specialization of the CompactHashSet class, and uses the == operator to compare objects.
-
-
Field Summary
-
Fields inherited from class net.ontopia.utils.CompactHashSet
deletedObject, elements, freecells, INITIAL_SIZE, LOAD_FACTOR, modCount, nullObject, objects
-
-
Constructor Summary
Constructors Constructor Description CompactIdentityHashSet()CompactIdentityHashSet(int size)CompactIdentityHashSet(Collection<E> coll)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(Object o)Adds the specified element to this set if it is not already present.booleancontains(Object o)Returns true if this set contains the specified element.protected voidrehash(int newCapacity)INTERNAL: Rehashes the hashset to a bigger size.booleanremove(Object o)Removes the specified element from the set.-
Methods inherited from class net.ontopia.utils.CompactHashSet
clear, dump, isEmpty, iterator, rehash, size, toArray, toArray
-
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
-
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.Set
addAll, containsAll, retainAll, spliterator
-
-
-
-
Constructor Detail
-
CompactIdentityHashSet
public CompactIdentityHashSet()
-
CompactIdentityHashSet
public CompactIdentityHashSet(int size)
-
CompactIdentityHashSet
public CompactIdentityHashSet(Collection<E> coll)
-
-
Method Detail
-
contains
public boolean contains(Object o)
Returns true if this set contains the specified element.- Specified by:
containsin interfaceCollection<E>- Specified by:
containsin interfaceSet<E>- Overrides:
containsin classCompactHashSet<E>- Parameters:
o- element whose presence in this set is to be tested.- Returns:
- true if this set contains the specified element.
-
add
public boolean add(Object o)
Adds the specified element to this set if it is not already present.- Specified by:
addin interfaceCollection<E>- Specified by:
addin interfaceSet<E>- Overrides:
addin classCompactHashSet<E>- Parameters:
o- element to be added to this set.- Returns:
- true if the set did not already contain the specified element.
-
remove
public boolean remove(Object o)
Removes the specified element from the set.- Specified by:
removein interfaceCollection<E>- Specified by:
removein interfaceSet<E>- Overrides:
removein classCompactHashSet<E>
-
rehash
protected void rehash(int newCapacity)
INTERNAL: Rehashes the hashset to a bigger size.- Overrides:
rehashin classCompactHashSet<E>
-
-