Class HashSet<A>
java.lang.Object
fj.data.HashSet<A>
- All Implemented Interfaces:
Iterable<A>
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a hash set with the given equality and hashing strategy.Construct a hash set with the given equality and hashing strategy.Construct a hash set with the given equality and hashing strategy. -
Method Summary
Modifier and TypeMethodDescriptionstatic <A> HashSet<A> arrayHashSet(A... as) Create a HashSet from the array.static <A> HashSet<A> arrayHashSet(Equal<A> e, Hash<A> h, A... as) Create a HashSet from the array.voidclear()Clear all elements from this hash set.booleanDetermines if this hash set contains the given element.booleanDeletes the given element from this hash set.static <A> HashSet<A> empty()Creates an empty HashSetstatic <A> HashSet<A> Creates a new HashSet using the given Equal and HashbooleanCompare two values for equality using the underlying equality strategy.static <A> HashSet<A> intCompute the hash of the given value using the underlying hashing strategy.static <A> HashSet<A> hashSet(A... as) Create a HashSet from the array.static <A> HashSet<A> Create a HashSet from the array.booleanisEmpty()Determines if this hash set contains any elements.static <A> HashSet<A> iterableHashSet(Equal<A> e, Hash<A> h, Iterable<A> it) Create a HashSet from the Iterable.static <A> HashSet<A> iterableHashSet(Iterable<A> it) Create a HashSet from the Iterable.iterator()Returns an iterator for this hash set.static <A> HashSet<A> iteratorHashSet(Equal<A> e, Hash<A> h, Iterator<A> it) Create a HashSet from the Iterator.static <A> HashSet<A> iteratorHashSet(Iterator<A> it) Create a HashSet from the Iterator.voidInsert the given element into this hash set.intsize()Returns the number of entries in this hash set.Projects an immutable collection of this hash set.toList()Returns a list projection of this hash set.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Field Details
-
m
-
-
Constructor Details
-
HashSet
-
HashSet
-
HashSet
-
-
Method Details
-
iterator
-
eq
-
hash
Compute the hash of the given value using the underlying hashing strategy.- Parameters:
a- The value to computer the hash of.- Returns:
- The hash of the given value.
-
empty
-
empty
Creates an empty HashSet -
iterableHashSet
-
iterableHashSet
-
iteratorHashSet
-
iteratorHashSet
-
arrayHashSet
Create a HashSet from the array. -
arrayHashSet
Create a HashSet from the array. -
hashSet
Create a HashSet from the array. -
hashSet
Create a HashSet from the array. -
contains
Determines if this hash set contains the given element.- Parameters:
a- The element to look for in this hash set.- Returns:
trueif this hash set contains the given element,falseotherwise.
-
set
Insert the given element into this hash set.- Parameters:
a- The element to insert.
-
clear
public void clear()Clear all elements from this hash set. -
isEmpty
public boolean isEmpty()Determines if this hash set contains any elements.- Returns:
trueif this hash set contains no elements,falseotherwise.
-
size
public int size()Returns the number of entries in this hash set.- Returns:
- The number of entries in this hash set.
-
delete
Deletes the given element from this hash set.- Parameters:
a- The element to delete from this hash set.- Returns:
trueif this hash set contained the given element prior to deletion,falseotherwise.
-
toList
-
toJavaList
-
toJavaSet
-
fromSet
-
toCollection
Projects an immutable collection of this hash set.- Returns:
- An immutable collection of this hash set.
-