Top Description Inners Fields Constructors Methods
io.rsocket.loadbalance

pack-priv Class Int2LongHashMap

extends Object
implements Map<Integer, Long>, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, java.util.Map
Imports
java.io.Serializable, java.util.AbstractCollection, .AbstractSet, .Arrays, .Iterator, .Map, .NoSuchElementException, .Objects, java.util.function.Function, .IntToLongFunction, reactor.util.annotation.Nullable

A open addressing with linear probing hash map specialised for primitive key and value pairs.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv abstract class
Int2LongHashMap.AbstractIterator

Base iterator implementation.

public class
Int2LongHashMap.EntryIterator

Iterator over entries which supports access to unboxed keys and values.

public class
Int2LongHashMap.EntrySet

Set of entries which supports optionally cached iterators to avoid allocation.

public class
Int2LongHashMap.KeyIterator

Iterator over keys which supports access to unboxed keys via nextValue().

public class
Int2LongHashMap.KeySet

Set of keys which supports optional cached iterators to avoid allocation.

public class
Int2LongHashMap.ValueCollection

Collection of values which supports optionally cached iterators to avoid allocation.

public class
Int2LongHashMap.ValueIterator

Iterator over values which supports access to unboxed values.

Field Summary

Modifier and TypeField and Description
pack-priv static final float
private long[]
private Int2LongHashMap.EntrySet
private Int2LongHashMap.KeySet
private final float
pack-priv static final int
private final long
private int
private static final long
private final boolean
private int
private Int2LongHashMap.ValueCollection

Constructor Summary

AccessConstructor and Description
public
Int2LongHashMap(final long
for the map that represents null.
missingValue
)

public
Int2LongHashMap(final int
for the map to override MIN_CAPACITY
initialCapacity
,
final float
for the map to override DEFAULT_LOAD_FACTOR.
loadFactor
,
final long
for the map that represents null.
missingValue
)

public
Int2LongHashMap(final int
for the map to override MIN_CAPACITY
initialCapacity
,
final float
for the map to override DEFAULT_LOAD_FACTOR.
loadFactor
,
final long
for the map that represents null.
missingValue
,
final boolean
should allocation be avoided by caching iterators and map entries.
shouldAvoidAllocation
)

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

the total capacity for the map.
capacity
()

Get the total capacity for the map to which the load factor will be a fraction of.

private void
capacity(final int newCapacity)

public void
clear()

Implements java.util.Map.clear.

Removes all of the mappings from this map (optional operation).
public void
compact()

Compact the backing arrays by rehashing with a capacity just larger than current size and giving consideration to the load factor.

private void
compactChain(int deleteKeyIndex)

public long

Returns:

the value if found otherwise the missing value.
computeIfAbsent
(final int
to search on.
key
,
final IntToLongFunction
to provide a value if the get returns null.
mappingFunction
)

Primitive specialised version of computeIfAbsent(Object, Function)

public boolean

Returns:

true if the map contains key as a key, false otherwise.
containsKey
(final int
the key to check.
key
)

Int primitive specialised containsKey.

public boolean
containsKey(final Object
key whose presence in this map is to be tested
key
)

Implements java.util.Map.containsKey.

Returns true if this map contains a mapping for the specified key.
public boolean

Returns:

true if contained otherwise value.
containsValue
(final long
to be tested against contained values.
value
)

Does the map contain the value.

public boolean
containsValue(final Object
value whose presence in this map is to be tested
value
)

Implements java.util.Map.containsValue.

Returns true if this map maps one or more keys to the specified value.
public Int2LongHashMap.EntrySet
entrySet()

Implements java.util.Map.entrySet.

Returns a Set view of the mappings contained in this map.
public boolean
equals(final Object
object to be compared for equality with this map
o
)

Overrides java.lang.Object.equals.

Implements java.util.Map.equals.

Compares the specified object with this map for equality.
private static int
evenHash(final int value, final int mask)

private static int
findNextPositivePowerOfTwo(final int value)

public long

Returns:

value associated with the key or missingValue() if key is not found in the map.
get
(final int
lookup key.
key
)

Get a value using provided key avoiding boxing.

public Long
get(final Object
the key whose associated value is to be returned
key
)

Implements java.util.Map.get.

Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
public int
hashCode()

Overrides java.lang.Object.hashCode.

Implements java.util.Map.hashCode.

Returns the hash code value for this map.
private void
public boolean
isEmpty()

Implements java.util.Map.isEmpty.

Returns true if this map contains no key-value mappings.
public Int2LongHashMap.KeySet
keySet()

Implements java.util.Map.keySet.

Returns a Set view of the keys contained in this map.
public float

Returns:

the load factor applied for resize operations.
loadFactor
()

Get the load factor applied for resize operations.

public long

Returns:

the maximum value stored in the map.
maxValue
()

Get the maximum value stored in the map.

public long

Returns:

the minimum value stored in the map.
minValue
()

Get the minimum value stored in the map.

public long

Returns:

value to be used as a null marker in the map.
missingValue
()

The value to be used as a null marker in the map.

private static int
next(final int index, final int mask)

public long

Returns:

previous value associated with the key, or missingValue() if none found
put
(final int
lookup key
key
,
final long
new value, must not be missingValue()
value
)

Implements java.util.Map.put.

Put a key value pair in the map.
public Long
put(final Integer
key with which the specified value is to be associated
key
,
final Long
value to be associated with the specified key
value
)

Implements java.util.Map.put.

Associates the specified value with the specified key in this map (optional operation).
public void
putAll(final Map<? extends Integer, ? extends Long>
mappings to be stored in this map
map
)

Implements java.util.Map.putAll.

Copies all of the mappings from the specified map to this map (optional operation).
private void
rehash(final int newCapacity)

public Long
remove(final Object
key whose mapping is to be removed from the map
key
)

Implements java.util.Map.remove.

Removes the mapping for a key from this map if it is present (optional operation).
public long

Returns:

removed value or missingValue() if key was not found in the map.
remove
(final int
whose mapping is to be removed from the map.
key
)

Remove value from the map using given key avoiding boxing.

public long

Returns:

the previous value associated with the specified key, or missingValue() if there was no mapping for the key.
replace
(final int
key with which the specified value is associated
key
,
final long
value to be associated with the specified key
value
)

Overrides default java.util.Map.replace.

Primitive specialised version of replace(Object, Object)
public boolean

Returns:

true if the value was replaced
replace
(final int
key with which the specified value is associated
key
,
final long
value expected to be associated with the specified key
oldValue
,
final long
value to be associated with the specified key
newValue
)

Overrides default java.util.Map.replace.

Primitive specialised version of replace(Object, Object, Object)
public int

Returns:

the threshold when the map will resize.
resizeThreshold
()

Get the actual threshold which when reached the map will resize.

public int
size()

Implements java.util.Map.size.

Returns the number of key-value mappings in this map.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
private static void
validateLoadFactor(final float loadFactor)

private Long
valOrNull(final long value)

public Int2LongHashMap.ValueCollection
values()

Implements java.util.Map.values.

Returns a Collection view of the values contained in this map.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait