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 HashSetprivate static final KeyFunction -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateHashSet()privateHashSet(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.booleanReturns true if the value exists in this set.static <E> @NotNull HashSet<E> empty()static <E> @NotNull BuilderFactory<E, HashSet<E>> factory()<U> voidAll collection methods can be built upon thisforEachdefinition.iterator()private KeyFunction<E, E> Removes the specified value from the set if it exists.intsize()Returns the size of the collection.Methods inherited from class com.github.andrewoma.dexx.collection.internal.base.AbstractSet
asSet, equals, hashCodeMethods inherited from class com.github.andrewoma.dexx.collection.internal.base.AbstractTraversable
isEmpty, makeString, makeString, to, toArray, toArray, toIndexedList, toSet, toSortedSet, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods 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:SetReturns a set that adds the specified value if it doesn't already exist in this set. -
remove
Description copied from interface:SetRemoves the specified value from the set if it exists. -
contains
Description copied from interface:SetReturns true if the value exists in this set. -
size
public int size()Description copied from interface:TraversableReturns the size of the collection.Warning: infinite collections are possible, as are collections that require traversal to calculate the size.
- Specified by:
sizein interfaceTraversable<E>- Overrides:
sizein classAbstractTraversable<E>
-
forEach
Description copied from interface:TraversableAll collection methods can be built upon thisforEachdefinition.- Specified by:
forEachin interfaceTraversable<E>- Overrides:
forEachin classAbstractIterable<E>
-
iterator
-