类 ConcurrentSortedLongPairSet
java.lang.Object
org.apache.pulsar.common.util.collections.ConcurrentSortedLongPairSet
- 所有已实现的接口:
LongPairSet
Sorted concurrent
LongPairSet which is not fully accurate in sorting.
ConcurrentSortedLongPairSet creates separate ConcurrentLongPairSet for unique first-key of
inserted item. So, it can iterate over all items by sorting on item's first key. However, item's second key will not
be sorted. eg:
insert: (1,2), (1,4), (2,1), (1,5), (2,6) while iterating set will first read all the entries for items whose first-key=1 and then first-key=2. output: (1,4), (1,5), (1,2), (2,6), (2,1)
This map can be expensive and not recommended if set has to store large number of unique item.first's key
because set has to create that many ConcurrentLongPairSet objects.
-
嵌套类概要
从接口继承的嵌套类/接口 org.apache.pulsar.common.util.collections.LongPairSet
LongPairSet.LongPairFunction<T>, LongPairSet.LongPairPredicate -
字段概要
字段 -
构造器概要
构造器构造器说明ConcurrentSortedLongPairSet(int expectedItems) ConcurrentSortedLongPairSet(int expectedItems, int concurrencyLevel) ConcurrentSortedLongPairSet(int expectedItems, int concurrencyLevel, boolean autoShrink) ConcurrentSortedLongPairSet(int expectedItems, int concurrencyLevel, int maxAllowedSetOnRemove) ConcurrentSortedLongPairSet(int expectedItems, int concurrencyLevel, int maxAllowedSetOnRemove, boolean autoShrink) -
方法概要
修饰符和类型方法说明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) 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) Removes composite value of item1 and item2 from set.intRemoves composite value of item1 and item2 from set if provided predicateLongPairSet.LongPairPredicatematches.longsize()Returns size of the set.toString()
-
字段详细资料
-
longPairSets
-
-
构造器详细资料
-
ConcurrentSortedLongPairSet
public ConcurrentSortedLongPairSet() -
ConcurrentSortedLongPairSet
public ConcurrentSortedLongPairSet(int expectedItems) -
ConcurrentSortedLongPairSet
public ConcurrentSortedLongPairSet(int expectedItems, int concurrencyLevel) -
ConcurrentSortedLongPairSet
public ConcurrentSortedLongPairSet(int expectedItems, int concurrencyLevel, boolean autoShrink) -
ConcurrentSortedLongPairSet
public ConcurrentSortedLongPairSet(int expectedItems, int concurrencyLevel, int maxAllowedSetOnRemove) -
ConcurrentSortedLongPairSet
public ConcurrentSortedLongPairSet(int expectedItems, int concurrencyLevel, int maxAllowedSetOnRemove, boolean autoShrink)
-
-
方法详细资料
-
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) 从接口复制的说明:LongPairSetRemoves composite value of item1 and item2 from set.- 指定者:
remove在接口中LongPairSet- 返回:
-
removeIf
从接口复制的说明:LongPairSetRemoves composite value of item1 and item2 from set if provided predicateLongPairSet.LongPairPredicatematches.- 指定者:
removeIf在接口中LongPairSet- 返回:
-
items
- 指定者:
items在接口中LongPairSet- 返回:
- a new list of all keys (makes a copy)
-
forEach
从接口复制的说明:LongPairSetExecuteConcurrentLongPairSet.LongPairConsumerprocessor for each entry in the set.- 指定者:
forEach在接口中LongPairSet
-
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
-
isEmpty
public boolean isEmpty()从接口复制的说明:LongPairSetCheck if set is empty.- 指定者:
isEmpty在接口中LongPairSet- 返回:
-
clear
public void clear()从接口复制的说明:LongPairSetRemoves all items from set.- 指定者:
clear在接口中LongPairSet
-
size
public long size()从接口复制的说明:LongPairSetReturns size of the set.- 指定者:
size在接口中LongPairSet- 返回:
-
capacity
public long capacity()从接口复制的说明:LongPairSetReturns capacity of the set.- 指定者:
capacity在接口中LongPairSet- 返回:
-
contains
public boolean contains(long item1, long item2) 从接口复制的说明:LongPairSetChecks if given (item1,item2) composite value exists into set.- 指定者:
contains在接口中LongPairSet- 返回:
-