public class LongHashSet extends AbstractSet<Long> implements Serializable
MISSING_VALUE
to account for Long.hashCode()
being 0 for -1.Modifier and Type | Class and Description |
---|---|
class |
LongHashSet.LongIterator
Iterator which supports unboxed access to values.
|
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_INITIAL_CAPACITY
The initial capacity used when none is specified in the constructor.
|
static float |
DEFAULT_LOAD_FACTOR |
Constructor and Description |
---|
LongHashSet()
Construct a hash set with
DEFAULT_INITIAL_CAPACITY and DEFAULT_LOAD_FACTOR . |
LongHashSet(int proposedCapacity)
Construct a hash set with a proposed capacity and
DEFAULT_LOAD_FACTOR . |
LongHashSet(int proposedCapacity,
float loadFactor)
Construct a hash set with a proposed initial capacity and load factor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(long value)
Primitive specialised overload of {this#add(Long)}
|
boolean |
add(Long value) |
boolean |
addAll(Collection<? extends Long> coll) |
int |
capacity()
Get the total capacity for the set to which the load factor with be a fraction of.
|
void |
clear() |
void |
compact()
Compact the backing arrays by rehashing with a capacity just larger than current size
and giving consideration to the load factor.
|
boolean |
contains(long value)
Contains method that does not box values.
|
boolean |
contains(Object value) |
boolean |
containsAll(LongHashSet other)
LongHashSet specialised variant of {this#containsAll(Collection)}.
|
boolean |
equals(Object other) |
int |
hashCode() |
boolean |
isEmpty() |
LongHashSet.LongIterator |
iterator() |
float |
loadFactor()
Get the load factor beyond which the set will increase size.
|
boolean |
remove(long value)
An int specialised version of {this#remove(Object)}.
|
boolean |
remove(Object value) |
boolean |
removeAll(Collection<?> coll) |
int |
resizeThreshold()
Get the actual threshold which when reached the map will resize.
|
int |
size() |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
String |
toString() |
containsAll, retainAll
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
containsAll, retainAll, spliterator
parallelStream, removeIf, stream
public static final int DEFAULT_INITIAL_CAPACITY
public static final float DEFAULT_LOAD_FACTOR
public LongHashSet()
DEFAULT_INITIAL_CAPACITY
and DEFAULT_LOAD_FACTOR
.public LongHashSet(int proposedCapacity)
DEFAULT_LOAD_FACTOR
.proposedCapacity
- for the initial capacity of the set.public LongHashSet(int proposedCapacity, float loadFactor)
proposedCapacity
- for the initial capacity of the set.loadFactor
- to be used for resizing.public float loadFactor()
public int capacity()
public int resizeThreshold()
public boolean add(Long value)
add
in interface Collection<Long>
add
in interface Set<Long>
add
in class AbstractCollection<Long>
public boolean add(long value)
value
- the value to addIllegalArgumentException
- if value is missingValuepublic boolean remove(Object value)
remove
in interface Collection<Long>
remove
in interface Set<Long>
remove
in class AbstractCollection<Long>
public boolean remove(long value)
value
- the value to removepublic void compact()
public boolean contains(Object value)
contains
in interface Collection<Long>
contains
in interface Set<Long>
contains
in class AbstractCollection<Long>
public boolean contains(long value)
value
- to be check for if the set contains it.Collection.contains(Object)
public int size()
size
in interface Collection<Long>
size
in interface Set<Long>
size
in class AbstractCollection<Long>
public boolean isEmpty()
isEmpty
in interface Collection<Long>
isEmpty
in interface Set<Long>
isEmpty
in class AbstractCollection<Long>
public void clear()
clear
in interface Collection<Long>
clear
in interface Set<Long>
clear
in class AbstractCollection<Long>
public boolean addAll(Collection<? extends Long> coll)
addAll
in interface Collection<Long>
addAll
in interface Set<Long>
addAll
in class AbstractCollection<Long>
public boolean removeAll(Collection<?> coll)
removeAll
in interface Collection<Long>
removeAll
in interface Set<Long>
removeAll
in class AbstractSet<Long>
public LongHashSet.LongIterator iterator()
public String toString()
toString
in class AbstractCollection<Long>
public <T> T[] toArray(T[] a)
toArray
in interface Collection<Long>
toArray
in interface Set<Long>
toArray
in class AbstractCollection<Long>
public Object[] toArray()
toArray
in interface Collection<Long>
toArray
in interface Set<Long>
toArray
in class AbstractCollection<Long>
public boolean containsAll(LongHashSet other)
other
- int hash set to compare against.public boolean equals(Object other)
equals
in interface Collection<Long>
equals
in interface Set<Long>
equals
in class AbstractSet<Long>
public int hashCode()
hashCode
in interface Collection<Long>
hashCode
in interface Set<Long>
hashCode
in class AbstractSet<Long>
Copyright © 2021 JBoss by Red Hat. All rights reserved.