类 ConcurrentLongPairSet
- 所有已实现的接口:
LongPairSet
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.
WARN: method forEach do not guarantee thread safety, nor does the items method.
The forEach method is specifically designed for single-threaded usage. When iterating over a set
with concurrent writes, it becomes possible for new values to be either observed or not observed.
There is no guarantee that if we write value1 and value2, and are able to see value2, then we will also see value1.
It is crucial to understand that the results obtained from aggregate status methods such as items
are typically reliable only when the map is not undergoing concurrent updates from other threads.
When concurrent updates are involved, the results of these methods reflect transient states
that may be suitable for monitoring or estimation purposes, but not for program control.
-
嵌套类概要
嵌套类修饰符和类型类说明static 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.从接口继承的嵌套类/接口 org.apache.pulsar.common.util.collections.LongPairSet
LongPairSet.LongPairFunction<T>, LongPairSet.LongPairPredicate -
构造器概要
构造器构造器说明已过时。ConcurrentLongPairSet(int expectedItems) 已过时。ConcurrentLongPairSet(int expectedItems, int concurrencyLevel) 已过时。ConcurrentLongPairSet(int expectedItems, int concurrencyLevel, float mapFillFactor, float mapIdleFactor, boolean autoShrink, float expandFactor, float shrinkFactor) -
方法概要
修饰符和类型方法说明booleanadd(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) Iterate over all the elements in the set and apply the provided function.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()
-
构造器详细资料
-
ConcurrentLongPairSet
已过时。 -
ConcurrentLongPairSet
已过时。 -
ConcurrentLongPairSet
已过时。 -
ConcurrentLongPairSet
public ConcurrentLongPairSet(int expectedItems, int concurrencyLevel, float mapFillFactor, float mapIdleFactor, boolean autoShrink, float expandFactor, float shrinkFactor)
-
-
方法详细资料
-
newBuilder
-
size
public long size()从接口复制的说明:LongPairSetReturns size of the set.- 指定者:
size在接口中LongPairSet- 返回:
-
capacity
public long capacity()从接口复制的说明:LongPairSetReturns capacity of the set.- 指定者:
capacity在接口中LongPairSet- 返回:
-
isEmpty
public boolean isEmpty()从接口复制的说明:LongPairSetCheck if set is empty.- 指定者:
isEmpty在接口中LongPairSet- 返回:
-
contains
public boolean contains(long item1, long item2) 从接口复制的说明:LongPairSetChecks if given (item1,item2) composite value exists into set.- 指定者:
contains在接口中LongPairSet- 返回:
-
add
public boolean add(long item1, long item2) 从接口复制的说明:LongPairSetAdds composite value of item1 and item2 to set.- 指定者:
add在接口中LongPairSet- 返回:
-
remove
public boolean remove(long item1, long item2) Remove an existing entry if found.- 指定者:
remove在接口中LongPairSet- 参数:
item1-- 返回:
- true if removed or false if item was not present
-
clear
public void clear()从接口复制的说明:LongPairSetRemoves all items from set.- 指定者:
clear在接口中LongPairSet
-
forEach
Iterate over all the elements in the set and apply the provided function.Warning: Do Not Guarantee Thread-Safety.
- 指定者:
forEach在接口中LongPairSet- 参数:
processor- the processor to process the elements
-
removeIf
Removes all of the elements of this collection that satisfy the given predicate.- 指定者:
removeIf在接口中LongPairSet- 参数:
filter- a predicate which returnstruefor elements to be removed- 返回:
- number of removed values
-
items
- 指定者:
items在接口中LongPairSet- 返回:
- a new set of all keys (makes a copy)
-
items
- 指定者:
items在接口中LongPairSet- 返回:
- a new list of keys with max provided numberOfItems (makes a copy)
-
items
- 指定者:
items在接口中LongPairSetlongPairConverter- converts (long,long) pair toobject - 返回:
- a new list of keys with max provided numberOfItems
-
toString
-