Class ConcurrentLongPairSet
java.lang.Object
org.apache.pulsar.common.util.collections.ConcurrentLongPairSet
- All Implemented Interfaces:
LongPairSet
Concurrent hash set where values are composed of pairs of longs.
Provides similar methods as a ConcurrentHashSet<V> but since it's an open hash set with linear probing,
no node allocations are required to store the keys and values, and no boxing is required.
Values MUST be >= 0.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder of ConcurrentLongPairSet.static interfaceRepresents a function that accepts an object of theLongPairtype.static classClass representing two long values.static interfaceRepresents a function that accepts two long arguments.Nested classes/interfaces inherited from interface org.apache.pulsar.common.util.collections.LongPairSet
LongPairSet.LongPairFunction<T>, LongPairSet.LongPairPredicate -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.ConcurrentLongPairSet(int expectedItems) Deprecated.ConcurrentLongPairSet(int expectedItems, int concurrencyLevel) Deprecated.ConcurrentLongPairSet(int expectedItems, int concurrencyLevel, float mapFillFactor, float mapIdleFactor, boolean autoShrink, float expandFactor, float shrinkFactor) -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(long item1, long item2) Adds composite value of item1 and item2 to set.longcapacity()Returns capacity of the set.voidclear()Removes all items from set.booleancontains(long item1, long item2) Checks if given (item1,item2) composite value exists into set.voidforEach(ConcurrentLongPairSet.LongPairConsumer processor) ExecuteConcurrentLongPairSet.LongPairConsumerprocessor for each entry in the set.booleanisEmpty()Check if set is empty.items()items(int numberOfItems) <T> Set<T>items(int numberOfItems, LongPairSet.LongPairFunction<T> longPairConverter) booleanremove(long item1, long item2) Remove an existing entry if found.intRemoves all of the elements of this collection that satisfy the given predicate.longsize()Returns size of the set.toString()
-
Constructor Details
-
ConcurrentLongPairSet
Deprecated. -
ConcurrentLongPairSet
Deprecated. -
ConcurrentLongPairSet
Deprecated. -
ConcurrentLongPairSet
public ConcurrentLongPairSet(int expectedItems, int concurrencyLevel, float mapFillFactor, float mapIdleFactor, boolean autoShrink, float expandFactor, float shrinkFactor)
-
-
Method Details
-
newBuilder
-
size
public long size()Description copied from interface:LongPairSetReturns size of the set.- Specified by:
sizein interfaceLongPairSet- Returns:
-
capacity
public long capacity()Description copied from interface:LongPairSetReturns capacity of the set.- Specified by:
capacityin interfaceLongPairSet- Returns:
-
isEmpty
public boolean isEmpty()Description copied from interface:LongPairSetCheck if set is empty.- Specified by:
isEmptyin interfaceLongPairSet- Returns:
-
contains
public boolean contains(long item1, long item2) Description copied from interface:LongPairSetChecks if given (item1,item2) composite value exists into set.- Specified by:
containsin interfaceLongPairSet- Returns:
-
add
public boolean add(long item1, long item2) Description copied from interface:LongPairSetAdds composite value of item1 and item2 to set.- Specified by:
addin interfaceLongPairSet- Returns:
-
remove
public boolean remove(long item1, long item2) Remove an existing entry if found.- Specified by:
removein interfaceLongPairSet- Parameters:
item1-- Returns:
- true if removed or false if item was not present
-
clear
public void clear()Description copied from interface:LongPairSetRemoves all items from set.- Specified by:
clearin interfaceLongPairSet
-
forEach
Description copied from interface:LongPairSetExecuteConcurrentLongPairSet.LongPairConsumerprocessor for each entry in the set.- Specified by:
forEachin interfaceLongPairSet
-
removeIf
Removes all of the elements of this collection that satisfy the given predicate.- Specified by:
removeIfin interfaceLongPairSet- Parameters:
filter- a predicate which returnstruefor elements to be removed- Returns:
- number of removed values
-
items
- Specified by:
itemsin interfaceLongPairSet- Returns:
- a new list of all keys (makes a copy)
-
items
- Specified by:
itemsin interfaceLongPairSet- Returns:
- a new list of keys with max provided numberOfItems (makes a copy)
-
items
- Specified by:
itemsin interfaceLongPairSetlongPairConverter- converts (long,long) pair toobject - Returns:
- a new list of keys with max provided numberOfItems
-
toString
-