Package com.pnfsoftware.jeb.util.collect
Class FastLongSet
A (small) set of
long values backed by a Bitmap for fast insertion/retrieval and
zero allocation at run-time. The set range must not exceed 4G; the recommended max range
should not exceed a few thousands.-
Constructor Summary
ConstructorsConstructorDescriptionFastLongSet(long end) Create a set for the range [0, end).FastLongSet(long from, long to) Create a set.FastLongSet(FastLongSet set0) Duplicate an existing set. -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanaddAll(Collection<? extends Long> c) voidaddAllFast(FastLongSet other) Fast version ofaddAll(Collection).voidclear()booleanbooleancontainsAll(Collection<?> c) booleaninthashCode()booleanisEmpty()iterator()booleanintsize()toString()Methods inherited from class java.util.AbstractSet
removeAllMethods inherited from class java.util.AbstractCollection
retainAll, toArray, toArrayMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Set
retainAll, spliterator, toArray, toArray
-
Constructor Details
-
FastLongSet
public FastLongSet(long from, long to) Create a set.- Parameters:
from- range start (inclusive)to- range end (exclusive)
-
FastLongSet
public FastLongSet(long end) Create a set for the range [0, end).- Parameters:
end- range end (exclusive)
-
FastLongSet
Duplicate an existing set.- Parameters:
set0- source set
-
-
Method Details
-
size
public int size()- Specified by:
sizein interfaceCollection<Long>- Specified by:
sizein interfaceSet<Long>- Specified by:
sizein classAbstractCollection<Long>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCollection<Long>- Specified by:
isEmptyin interfaceSet<Long>- Overrides:
isEmptyin classAbstractCollection<Long>
-
clear
public void clear()- Specified by:
clearin interfaceCollection<Long>- Specified by:
clearin interfaceSet<Long>- Overrides:
clearin classAbstractCollection<Long>
-
add
- Specified by:
addin interfaceCollection<Long>- Specified by:
addin interfaceSet<Long>- Overrides:
addin classAbstractCollection<Long>
-
remove
- Specified by:
removein interfaceCollection<Long>- Specified by:
removein interfaceSet<Long>- Overrides:
removein classAbstractCollection<Long>
-
contains
- Specified by:
containsin interfaceCollection<Long>- Specified by:
containsin interfaceSet<Long>- Overrides:
containsin classAbstractCollection<Long>
-
containsAll
- Specified by:
containsAllin interfaceCollection<Long>- Specified by:
containsAllin interfaceSet<Long>- Overrides:
containsAllin classAbstractCollection<Long>
-
addAll
- Specified by:
addAllin interfaceCollection<Long>- Specified by:
addAllin interfaceSet<Long>- Overrides:
addAllin classAbstractCollection<Long>
-
addAllFast
Fast version ofaddAll(Collection). Restrictions: the input collection must be aFastLongSetof the exact range.- Parameters:
other-
-
iterator
-
toString
- Overrides:
toStringin classAbstractCollection<Long>
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCollection<Long>- Specified by:
hashCodein interfaceSet<Long>- Overrides:
hashCodein classAbstractSet<Long>
-
equals
- Specified by:
equalsin interfaceCollection<Long>- Specified by:
equalsin interfaceSet<Long>- Overrides:
equalsin classAbstractSet<Long>
-