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
ConstructorsConstructorDescriptionCreate 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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods 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)
-