public class ConcurrentLongPairSet extends Object implements 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.
| Modifier and Type | Class and Description |
|---|---|
static interface |
ConcurrentLongPairSet.ConsumerLong
Represents a function that accepts an object of the
LongPair type. |
static class |
ConcurrentLongPairSet.LongPair
Class representing two long values.
|
static interface |
ConcurrentLongPairSet.LongPairConsumer
Represents a function that accepts two long arguments.
|
LongPairSet.LongPairFunction<T>, LongPairSet.LongPairPredicate| Constructor and Description |
|---|
ConcurrentLongPairSet() |
ConcurrentLongPairSet(int expectedItems) |
ConcurrentLongPairSet(int expectedItems,
int concurrencyLevel) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(long item1,
long item2)
Adds composite value of item1 and item2 to set.
|
long |
capacity() |
void |
clear()
Removes all items from set.
|
boolean |
contains(long item1,
long item2)
Checks if given (item1,item2) composite value exists into set.
|
void |
forEach(ConcurrentLongPairSet.LongPairConsumer processor)
Execute
ConcurrentLongPairSet.LongPairConsumer processor for each entry in the set. |
boolean |
isEmpty()
Check if set is empty.
|
Set<ConcurrentLongPairSet.LongPair> |
items() |
Set<ConcurrentLongPairSet.LongPair> |
items(int numberOfItems) |
<T> Set<T> |
items(int numberOfItems,
LongPairSet.LongPairFunction<T> longPairConverter) |
boolean |
remove(long item1,
long item2)
Remove an existing entry if found.
|
int |
removeIf(LongPairSet.LongPairPredicate filter)
Removes all of the elements of this collection that satisfy the given predicate.
|
long |
size()
Returns size of the set.
|
String |
toString() |
public ConcurrentLongPairSet()
public ConcurrentLongPairSet(int expectedItems)
public ConcurrentLongPairSet(int expectedItems,
int concurrencyLevel)
public long size()
LongPairSetsize in interface LongPairSetpublic long capacity()
public boolean isEmpty()
LongPairSetisEmpty in interface LongPairSetpublic boolean contains(long item1,
long item2)
LongPairSetcontains in interface LongPairSetpublic boolean add(long item1,
long item2)
LongPairSetadd in interface LongPairSetpublic boolean remove(long item1,
long item2)
remove in interface LongPairSetitem1 - public void clear()
LongPairSetclear in interface LongPairSetpublic void forEach(ConcurrentLongPairSet.LongPairConsumer processor)
LongPairSetConcurrentLongPairSet.LongPairConsumer processor for each entry in the set.forEach in interface LongPairSetpublic int removeIf(LongPairSet.LongPairPredicate filter)
removeIf in interface LongPairSetfilter - a predicate which returns true for elements to be removedpublic Set<ConcurrentLongPairSet.LongPair> items()
items in interface LongPairSetpublic Set<ConcurrentLongPairSet.LongPair> items(int numberOfItems)
items in interface LongPairSetpublic <T> Set<T> items(int numberOfItems, LongPairSet.LongPairFunction<T> longPairConverter)
items in interface LongPairSetlongPairConverter - converts (long,long) pair to Copyright © 2017–2021 Apache Software Foundation. All rights reserved.