Class ConcurrentLongHashSet
- java.lang.Object
-
- org.apache.bookkeeper.util.collections.ConcurrentLongHashSet
-
public class ConcurrentLongHashSet extends java.lang.Object
Concurrent hash set for primitive longs.Provides similar methods as a ConcurrentSet<Long> but since it's an open hash map with linear probing, no node allocations are required to store the values.
Items MUST be >= 0.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ConcurrentLongHashSet.Builder
Builder of ConcurrentLongHashSet.static interface
ConcurrentLongHashSet.ConsumerLong
A consumer of long values.
-
Constructor Summary
Constructors Constructor Description ConcurrentLongHashSet()
Deprecated.ConcurrentLongHashSet(int expectedItems)
Deprecated.ConcurrentLongHashSet(int expectedItems, int concurrencyLevel)
Deprecated.ConcurrentLongHashSet(int expectedItems, int concurrencyLevel, float mapFillFactor, float mapIdleFactor, boolean autoShrink, float expandFactor, float shrinkFactor)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(long item)
long
capacity()
void
clear()
boolean
contains(long item)
void
forEach(ConcurrentLongHashSet.ConsumerLong processor)
(package private) long
getUsedBucketCount()
(package private) static long
hash(long key)
boolean
isEmpty()
java.util.Set<java.lang.Long>
items()
static ConcurrentLongHashSet.Builder
newBuilder()
boolean
remove(long item)
Remove an existing entry if found.(package private) static int
signSafeMod(long n, int max)
long
size()
-
-
-
Constructor Detail
-
ConcurrentLongHashSet
@Deprecated public ConcurrentLongHashSet()
Deprecated.
-
ConcurrentLongHashSet
@Deprecated public ConcurrentLongHashSet(int expectedItems)
Deprecated.
-
ConcurrentLongHashSet
@Deprecated public ConcurrentLongHashSet(int expectedItems, int concurrencyLevel)
Deprecated.
-
ConcurrentLongHashSet
public ConcurrentLongHashSet(int expectedItems, int concurrencyLevel, float mapFillFactor, float mapIdleFactor, boolean autoShrink, float expandFactor, float shrinkFactor)
-
-
Method Detail
-
newBuilder
public static ConcurrentLongHashSet.Builder newBuilder()
-
size
public long size()
-
capacity
public long capacity()
-
isEmpty
public boolean isEmpty()
-
getUsedBucketCount
long getUsedBucketCount()
-
contains
public boolean contains(long item)
-
add
public boolean add(long item)
-
remove
public boolean remove(long item)
Remove an existing entry if found.- Parameters:
item
-- Returns:
- true if removed or false if item was not present
-
clear
public void clear()
-
forEach
public void forEach(ConcurrentLongHashSet.ConsumerLong processor)
-
items
public java.util.Set<java.lang.Long> items()
- Returns:
- a new list of all keys (makes a copy)
-
hash
static final long hash(long key)
-
signSafeMod
static final int signSafeMod(long n, int max)
-
-