Class HashSet<E>
java.lang.Object
com.github.andrewoma.dexx.collection.internal.base.AbstractTraversable<E>
com.github.andrewoma.dexx.collection.internal.base.AbstractIterable<E>
com.github.andrewoma.dexx.collection.internal.base.AbstractSet<E>
com.github.andrewoma.dexx.collection.HashSet<E>
- All Implemented Interfaces:
Iterable<E>
,Set<E>
,Traversable<E>
,Iterable<E>
HashSet
is an implementation of Set
backed by a HashMap
.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CompactHashMap
<E, E> private static final HashSet
private static final KeyFunction
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
HashSet()
private
HashSet
(CompactHashMap<E, E> compactHashMap) -
Method Summary
Modifier and TypeMethodDescriptionReturns a set that adds the specified value if it doesn't already exist in this set.boolean
Returns true if the value exists in this set.static <E> @NotNull HashSet
<E> empty()
static <E> @NotNull BuilderFactory
<E, HashSet<E>> factory()
<U> void
All collection methods can be built upon thisforEach
definition.iterator()
private KeyFunction
<E, E> Removes the specified value from the set if it exists.int
size()
Returns the size of the collection.Methods inherited from class com.github.andrewoma.dexx.collection.internal.base.AbstractSet
asSet, equals, hashCode
Methods inherited from class com.github.andrewoma.dexx.collection.internal.base.AbstractTraversable
isEmpty, makeString, makeString, to, toArray, toArray, toIndexedList, toSet, toSortedSet, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface com.github.andrewoma.dexx.collection.Traversable
isEmpty, makeString, makeString, to, toArray, toArray, toIndexedList, toSet, toSortedSet
-
Field Details
-
EMPTY
-
keyFunction
-
compactHashMap
-
-
Constructor Details
-
HashSet
private HashSet() -
HashSet
-
-
Method Details
-
factory
-
empty
-
keyFunction
-
add
Description copied from interface:Set
Returns a set that adds the specified value if it doesn't already exist in this set. -
remove
Description copied from interface:Set
Removes the specified value from the set if it exists. -
contains
Description copied from interface:Set
Returns true if the value exists in this set. -
size
public int size()Description copied from interface:Traversable
Returns the size of the collection.Warning: infinite collections are possible, as are collections that require traversal to calculate the size.
- Specified by:
size
in interfaceTraversable<E>
- Overrides:
size
in classAbstractTraversable<E>
-
forEach
Description copied from interface:Traversable
All collection methods can be built upon thisforEach
definition.- Specified by:
forEach
in interfaceTraversable<E>
- Overrides:
forEach
in classAbstractIterable<E>
-
iterator
-