V - the type of mapped valuespublic class ConcurrentSkipListIntObjMultimap<V> extends Object implements Iterable<ConcurrentSkipListIntObjMultimap.IntEntry<V>>
int keys.
This class implements a concurrent variant of SkipLists
providing expected average log(n) time cost for the
containsKey, get, put and
remove operations and their variants. Insertion, removal,
update, and access operations safely execute concurrently by
multiple threads.
This class is a multimap, which means the same key can be associated with
multiple values. Each such instance will be represented by a separate
IntEntry. There is no defined ordering for the values mapped to
the same key.
As a multimap, certain atomic operations like putIfPresent,
compute, or computeIfPresent, cannot be supported.
Likewise, some get-like operations cannot be supported.
Iterators and spliterators are weakly consistent.
All IntEntry pairs returned by methods in this class
represent snapshots of mappings at the time they were
produced. They do not support the Entry.setValue
method. (Note however that it is possible to change mappings in the
associated map using put, putIfAbsent, or
replace, depending on exactly which effect you need.)
Beware that bulk operations putAll, equals,
toArray, containsValue, and clear are
not guaranteed to be performed atomically. For example, an
iterator operating concurrently with a putAll operation
might view only some of the added elements.
This class does not permit the use of null values
because some null return values cannot be reliably distinguished from
the absence of elements.
| Modifier and Type | Class and Description |
|---|---|
static class |
ConcurrentSkipListIntObjMultimap.IntEntry<V>
The multimap entry type with primitive
int keys. |
| Constructor and Description |
|---|
ConcurrentSkipListIntObjMultimap(int noKey)
Constructs a new, empty map, sorted according to the
natural ordering of the keys.
|
| Modifier and Type | Method and Description |
|---|---|
ConcurrentSkipListIntObjMultimap.IntEntry<V> |
ceilingEntry(int key)
Returns a key-value mapping associated with the least key
greater than or equal to the given key, or
null if
there is no such entry. |
int |
ceilingKey(int key) |
void |
clear()
Removes all of the mappings from this map.
|
boolean |
containsKey(int key)
Returns
true if this map contains a mapping for the specified
key. |
boolean |
containsValue(Object value)
Returns
true if this map maps one or more keys to the
specified value. |
ConcurrentSkipListIntObjMultimap.IntEntry<V> |
firstEntry()
Returns a key-value mapping associated with the least
key in this map, or
null if the map is empty. |
int |
firstKey() |
ConcurrentSkipListIntObjMultimap.IntEntry<V> |
floorEntry(int key)
Returns a key-value mapping associated with the greatest key
less than or equal to the given key, or
null if there
is no such key. |
int |
floorKey(int key) |
V |
get(int key)
Returns the value to which the specified key is mapped,
or
null if this map contains no mapping for the key. |
V |
getOrDefault(int key,
V defaultValue)
Returns the value to which the specified key is mapped,
or the given defaultValue if this map contains no mapping for the key.
|
ConcurrentSkipListIntObjMultimap.IntEntry<V> |
higherEntry(int key)
Returns a key-value mapping associated with the least key
strictly greater than the given key, or
null if there
is no such key. |
int |
higherKey(int key) |
boolean |
isEmpty()
Check if the collection is empty.
|
Iterator<ConcurrentSkipListIntObjMultimap.IntEntry<V>> |
iterator() |
ConcurrentSkipListIntObjMultimap.IntEntry<V> |
lastEntry()
Returns a key-value mapping associated with the greatest
key in this map, or
null if the map is empty. |
int |
lastKey() |
ConcurrentSkipListIntObjMultimap.IntEntry<V> |
lowerEntry(int key)
Returns a key-value mapping associated with the greatest key
strictly less than the given key, or
null if there is
no such key. |
int |
lowerKey(int key) |
ConcurrentSkipListIntObjMultimap.IntEntry<V> |
pollCeilingEntry(int key) |
ConcurrentSkipListIntObjMultimap.IntEntry<V> |
pollFirstEntry()
Removes and returns a key-value mapping associated with
the least key in this map, or
null if the map is empty. |
ConcurrentSkipListIntObjMultimap.IntEntry<V> |
pollLastEntry()
Removes and returns a key-value mapping associated with
the greatest key in this map, or
null if the map is empty. |
void |
put(int key,
V value)
Associates the specified value with the specified key in this map.
|
V |
remove(int key)
Removes the mapping for the specified key from this map if present.
|
boolean |
remove(int key,
Object value)
Remove the specific entry with the given key and value, if it exist.
|
boolean |
replace(int key,
V oldValue,
V newValue)
Replace the specific entry with the given key and value, with the given replacement value,
if such an entry exist.
|
int |
size()
Get the approximate size of the collection.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic ConcurrentSkipListIntObjMultimap(int noKey)
noKey - The value to use as a sentinel for signaling the absence of a key.public boolean containsKey(int key)
true if this map contains a mapping for the specified
key.key - key whose presence in this map is to be testedtrue if this map contains a mapping for the specified keyClassCastException - if the specified key cannot be compared
with the keys currently in the mapNullPointerException - if the specified key is nullpublic V get(int key)
null if this map contains no mapping for the key.
More formally, if this map contains a mapping from a key
k to a value v such that key compares
equal to k according to the map's ordering, then this
method returns v; otherwise it returns null.
(There can be at most one such mapping.)
ClassCastException - if the specified key cannot be compared
with the keys currently in the mapNullPointerException - if the specified key is nullpublic V getOrDefault(int key, V defaultValue)
key - the keydefaultValue - the value to return if this map contains
no mapping for the given keyNullPointerException - if the specified key is nullpublic void put(int key,
V value)
key - key with which the specified value is to be associatedvalue - value to be associated with the specified keyClassCastException - if the specified key cannot be compared
with the keys currently in the mapNullPointerException - if the specified key or value is nullpublic V remove(int key)
key - key for which mapping should be removednull if there was no mapping for the keyClassCastException - if the specified key cannot be compared
with the keys currently in the mapNullPointerException - if the specified key is nullpublic boolean containsValue(Object value)
true if this map maps one or more keys to the
specified value. This operation requires time linear in the
map size. Additionally, it is possible for the map to change
during execution of this method, in which case the returned
result may be inaccurate.value - value whose presence in this map is to be testedtrue if a mapping to value exists;
false otherwiseNullPointerException - if the specified value is nullpublic int size()
public boolean isEmpty()
public void clear()
public boolean remove(int key,
Object value)
ClassCastException - if the specified key cannot be compared
with the keys currently in the mapNullPointerException - if the specified key is nullpublic boolean replace(int key,
V oldValue,
V newValue)
ClassCastException - if the specified key cannot be compared
with the keys currently in the mapNullPointerException - if any of the arguments are nullpublic int firstKey()
public int lastKey()
public ConcurrentSkipListIntObjMultimap.IntEntry<V> lowerEntry(int key)
null if there is
no such key. The returned entry does not support the
Entry.setValue method.NullPointerException - if the specified key is nullpublic int lowerKey(int key)
NullPointerException - if the specified key is nullpublic ConcurrentSkipListIntObjMultimap.IntEntry<V> floorEntry(int key)
null if there
is no such key. The returned entry does not support
the Entry.setValue method.key - the keyNullPointerException - if the specified key is nullpublic int floorKey(int key)
key - the keyNullPointerException - if the specified key is nullpublic ConcurrentSkipListIntObjMultimap.IntEntry<V> ceilingEntry(int key)
null if
there is no such entry. The returned entry does not
support the Entry.setValue method.NullPointerException - if the specified key is nullpublic int ceilingKey(int key)
NullPointerException - if the specified key is nullpublic ConcurrentSkipListIntObjMultimap.IntEntry<V> higherEntry(int key)
null if there
is no such key. The returned entry does not support
the Entry.setValue method.key - the keyNullPointerException - if the specified key is nullpublic int higherKey(int key)
key - the keyNullPointerException - if the specified key is nullpublic ConcurrentSkipListIntObjMultimap.IntEntry<V> firstEntry()
null if the map is empty.
The returned entry does not support
the Entry.setValue method.public ConcurrentSkipListIntObjMultimap.IntEntry<V> lastEntry()
null if the map is empty.
The returned entry does not support
the Entry.setValue method.public ConcurrentSkipListIntObjMultimap.IntEntry<V> pollFirstEntry()
null if the map is empty.
The returned entry does not support
the Entry.setValue method.public ConcurrentSkipListIntObjMultimap.IntEntry<V> pollLastEntry()
null if the map is empty.
The returned entry does not support
the Entry.setValue method.public ConcurrentSkipListIntObjMultimap.IntEntry<V> pollCeilingEntry(int key)
public Iterator<ConcurrentSkipListIntObjMultimap.IntEntry<V>> iterator()
iterator in interface Iterable<ConcurrentSkipListIntObjMultimap.IntEntry<V>>Copyright © 2008–2026 The Netty Project. All rights reserved.