Class BasedHashSet<E>
java.lang.Object
com.gigaspaces.internal.utils.collections.BasedHashSet<E>
- All Implemented Interfaces:
Iterable<E>,Collection<E>,Set<E>
- Direct Known Subclasses:
ConcurrentHashSet,CopyOnUpdateSet
Provides a base for any Map based HashSet implementation.
- Since:
- 7.0
- Author:
- Guy Korland
-
Constructor Summary
ConstructorsConstructorDescriptionBasedHashSet(Map<E, Object> map) Constructs a new, empty set; the backing HashMap instance has default initial capacity (16) and load factor (0.75). -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdds the specified element to this set if it is not already present.booleanaddAll(Collection<? extends E> c) voidclear()Removes all of the elements from this set.booleanReturns true if this set contains the specified element.booleancontainsAll(Collection<?> c) booleanisEmpty()Returns true if this set contains no elements.iterator()Returns an iterator over the elements in this set.booleanRemoves the specified element from this set if it is present.booleanremoveAll(Collection<?> c) booleanretainAll(Collection<?> c) intsize()Returns the number of elements in this set (its cardinality).Object[]toArray()<T> T[]toArray(T[] a) toString()Methods 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
-
BasedHashSet
Constructs a new, empty set; the backing HashMap instance has default initial capacity (16) and load factor (0.75).
-
-
Method Details
-
iterator
Returns an iterator over the elements in this set. The elements are returned in no particular order. -
size
public int size()Returns the number of elements in this set (its cardinality). -
isEmpty
public boolean isEmpty()Returns true if this set contains no elements. -
contains
Returns true if this set contains the specified element. -
add
Adds the specified element to this set if it is not already present. -
remove
Removes the specified element from this set if it is present. -
clear
public void clear()Removes all of the elements from this set. -
addAll
-
containsAll
- Specified by:
containsAllin interfaceCollection<E>- Specified by:
containsAllin interfaceSet<E>
-
removeAll
-
retainAll
-
toArray
-
toArray
public <T> T[] toArray(T[] a) -
toString
-