public class LongHashSet
extends java.lang.Object
| Constructor and Description |
|---|
LongHashSet()
Constructs a new, empty set; the backing HashMap instance has
default initial capacity (16) and load factor (0.75).
|
LongHashSet(java.util.Collection<java.lang.Long> c)
Constructs a new set containing the elements in the specified
collection.
|
LongHashSet(int initialCapacity)
Constructs a new, empty set; the backing HashMap instance has
the specified initial capacity and default load factor, which is
0.75.
|
LongHashSet(int initialCapacity,
float loadFactor)
Constructs a new, empty set; the backing HashMap instance has
the specified initial capacity and the specified load factor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(long o)
Adds the specified element to this set if it is not already
present.
|
void |
clear()
Removes all of the elements from this set.
|
java.lang.Object |
clone()
Returns a shallow copy of this HashSet instance: the elements
themselves are not cloned.
|
boolean |
contains(long o)
Returns true if this set contains the specified element.
|
boolean |
isEmpty()
Returns true if this set contains no elements.
|
boolean |
remove(long o)
Removes the specified element from this set if it is present.
|
int |
size()
Returns the number of elements in this set (its cardinality).
|
long[] |
toArray()
Returns an array of the elements in this set.
|
public LongHashSet()
public LongHashSet(java.util.Collection<java.lang.Long> c)
c - the collection whose elements are to be placed into this set.java.lang.NullPointerException - if the specified collection is null.public LongHashSet(int initialCapacity,
float loadFactor)
initialCapacity - the initial capacity of the hash map.loadFactor - the load factor of the hash map.java.lang.IllegalArgumentException - if the initial capacity is less
than zero, or if the load factor is nonpositive.public LongHashSet(int initialCapacity)
initialCapacity - the initial capacity of the hash table.java.lang.IllegalArgumentException - if the initial capacity is less
than zero.public long[] toArray()
ConcurrentModificationExceptionpublic int size()
public boolean isEmpty()
public boolean contains(long o)
o - element whose presence in this set is to be tested.public boolean add(long o)
o - element to be added to this set.public boolean remove(long o)
o - object to be removed from this set, if present.public void clear()
public java.lang.Object clone()
clone in class java.lang.Object