Package org.plumelib.util
Class IdentityMostlySingletonSet<T>
java.lang.Object
org.plumelib.util.AbstractMostlySingletonSet<T>
org.plumelib.util.IdentityMostlySingletonSet<T>
- Type Parameters:
T
- the type of elements of the set
- All Implemented Interfaces:
Iterable<T>
,Collection<T>
,Set<T>
An arbitrary-size set that is very efficient (more efficient than HashSet) for 0 and 1 elements.
Uses object identity for object comparison.
Usually, you should use IdentityArraySet
instead. The advantage of this over IdentityArraySet
is that this is efficient for large sets.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.plumelib.util.AbstractMostlySingletonSet
AbstractMostlySingletonSet.State
-
Field Summary
Fields inherited from class org.plumelib.util.AbstractMostlySingletonSet
set, state, value
-
Constructor Summary
ConstructorDescriptionCreate an IdentityMostlySingletonSet.IdentityMostlySingletonSet
(T value) Create an IdentityMostlySingletonSet containing one value. -
Method Summary
Methods inherited from class org.plumelib.util.AbstractMostlySingletonSet
addAll, checkRep, clear, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.Set
equals, hashCode, spliterator
-
Constructor Details
-
IdentityMostlySingletonSet
public IdentityMostlySingletonSet()Create an IdentityMostlySingletonSet. -
IdentityMostlySingletonSet
Create an IdentityMostlySingletonSet containing one value.- Parameters:
value
- the single element of the set
-
-
Method Details
-
add
-
contains
public boolean contains(@GuardSatisfied IdentityMostlySingletonSet<T> this, @GuardSatisfied @UnknownSignedness Object o)
-