public class CompactHashSet<T> extends AbstractSet<T>
Constructor and Description |
---|
CompactHashSet()
Constructs a new, empty set.
|
CompactHashSet(Collection c)
Constructs a new set containing the elements in the specified
collection.
|
CompactHashSet(int size)
Constructs a new, empty set.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(T x)
Adds the specified element to this set if it is not already
present.
|
void |
clear()
Removes all of the elements from this set.
|
boolean |
contains(Object o)
Returns true if this set contains the specified element.
|
void |
dump()
INTERNAL: Used for debugging only.
|
boolean |
isEmpty()
Returns true if this set contains no elements.
|
Iterator |
iterator()
Returns an iterator over the elements in this set.
|
boolean |
remove(Object o)
Removes the specified element from the set.
|
int |
size()
Returns the number of elements in this set (its cardinality).
|
Object[] |
toArray() |
Object[] |
toArray(Object[] a) |
equals, hashCode, removeAll
addAll, containsAll, retainAll, toString
addAll, containsAll, retainAll, spliterator
parallelStream, removeIf, stream
public CompactHashSet()
public CompactHashSet(Collection c)
c
- the collection whose elements are to be placed into this set.public CompactHashSet(int size)
public boolean add(T x)
add
in interface Collection<T>
add
in interface Set<T>
add
in class AbstractCollection<T>
x
- element to be added to this set.public void clear()
clear
in interface Collection<T>
clear
in interface Set<T>
clear
in class AbstractCollection<T>
public boolean contains(Object o)
contains
in interface Collection<T>
contains
in interface Set<T>
contains
in class AbstractCollection<T>
o
- element whose presence in this set is to be tested.public void dump()
public boolean isEmpty()
isEmpty
in interface Collection<T>
isEmpty
in interface Set<T>
isEmpty
in class AbstractCollection<T>
public Iterator iterator()
iterator
in interface Iterable<T>
iterator
in interface Collection<T>
iterator
in interface Set<T>
iterator
in class AbstractCollection<T>
ConcurrentModificationException
public boolean remove(Object o)
remove
in interface Collection<T>
remove
in interface Set<T>
remove
in class AbstractCollection<T>
public int size()
size
in interface Collection<T>
size
in interface Set<T>
size
in class AbstractCollection<T>
public Object[] toArray()
toArray
in interface Collection<T>
toArray
in interface Set<T>
toArray
in class AbstractCollection<T>
Copyright © 2024 Global Biodiversity Information Facility (GBIF). All rights reserved.