Class NonNullLong2WidgetInstanceHashMap
- All Implemented Interfaces:
it.unimi.dsi.fastutil.Function<Long,
,WidgetInstance<?>> it.unimi.dsi.fastutil.Hash
,it.unimi.dsi.fastutil.longs.Long2ObjectFunction<WidgetInstance<?>>
,it.unimi.dsi.fastutil.longs.Long2ObjectMap<WidgetInstance<?>>
,Serializable
,Cloneable
,Function<Long,
,WidgetInstance<?>> LongFunction<WidgetInstance<?>>
,Map<Long,
WidgetInstance<?>>
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class it.unimi.dsi.fastutil.longs.AbstractLong2ObjectMap
it.unimi.dsi.fastutil.longs.AbstractLong2ObjectMap.BasicEntry<V>, it.unimi.dsi.fastutil.longs.AbstractLong2ObjectMap.BasicEntrySet<V>
Nested classes/interfaces inherited from interface it.unimi.dsi.fastutil.Hash
it.unimi.dsi.fastutil.Hash.Strategy<K>
Nested classes/interfaces inherited from interface it.unimi.dsi.fastutil.longs.Long2ObjectMap
it.unimi.dsi.fastutil.longs.Long2ObjectMap.Entry<V>, it.unimi.dsi.fastutil.longs.Long2ObjectMap.FastEntrySet<V>
-
Field Summary
Fields inherited from class it.unimi.dsi.fastutil.longs.AbstractLong2ObjectFunction
defRetValue
Fields inherited from interface it.unimi.dsi.fastutil.Hash
DEFAULT_GROWTH_FACTOR, DEFAULT_INITIAL_SIZE, DEFAULT_LOAD_FACTOR, FAST_LOAD_FACTOR, FREE, OCCUPIED, PRIMES, REMOVED, VERY_FAST_LOAD_FACTOR
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
clone()
Returns a deep copy of this map.compute
(long k, BiFunction<? super Long, ? super WidgetInstance<?>, ? extends WidgetInstance<?>> remappingFunction) computeIfAbsent
(long key, it.unimi.dsi.fastutil.longs.Long2ObjectFunction<? extends WidgetInstance<?>> mappingFunction) computeIfAbsent
(long k, LongFunction<? extends WidgetInstance<?>> mappingFunction) computeIfPresent
(long k, BiFunction<? super Long, ? super WidgetInstance<?>, ? extends WidgetInstance<?>> remappingFunction) boolean
containsKey
(long k) boolean
boolean
void
forEachValue
(WidgetInstanceConsumer consumer) get
(long k) getOrDefault
(long k, WidgetInstance<?> defaultValue) int
hashCode()
Returns a hash code for this map.boolean
isEmpty()
it.unimi.dsi.fastutil.longs.LongSet
keySet()
it.unimi.dsi.fastutil.longs.Long2ObjectMap.FastEntrySet
<WidgetInstance<?>> merge
(long k, WidgetInstance<?> v, BiFunction<? super WidgetInstance<?>, ? super WidgetInstance<?>, ? extends WidgetInstance<?>> remappingFunction) put
(long k, WidgetInstance<?> v) void
putAll
(Map<? extends Long, ? extends WidgetInstance<?>> m) putIfAbsent
(long k, WidgetInstance<?> v) protected void
rehash
(int newN) Rehashes the map.remove
(long k) boolean
replace
(long k, WidgetInstance<?> v) boolean
replace
(long k, WidgetInstance<?> oldValue, WidgetInstance<?> v) protected final void
shiftKeys
(int pos) Shifts left entries with the specified hash code, starting at the specified position, and empties the resulting free entry.int
size()
boolean
trim()
Rehashes the map, making the table as small as possible.boolean
trim
(int n) Rehashes this map if the table is too large.it.unimi.dsi.fastutil.objects.ObjectCollection
<WidgetInstance<?>> values()
Methods inherited from class it.unimi.dsi.fastutil.longs.AbstractLong2ObjectMap
toString
Methods inherited from class it.unimi.dsi.fastutil.longs.AbstractLong2ObjectFunction
defaultReturnValue, defaultReturnValue
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface it.unimi.dsi.fastutil.Function
apply
Methods inherited from interface it.unimi.dsi.fastutil.longs.Long2ObjectFunction
andThenByte, andThenChar, andThenDouble, andThenFloat, andThenInt, andThenLong, andThenObject, andThenReference, andThenShort, apply, compose, composeByte, composeChar, composeDouble, composeFloat, composeInt, composeLong, composeObject, composeReference, composeShort
Methods inherited from interface it.unimi.dsi.fastutil.longs.Long2ObjectMap
computeIfAbsentPartial, containsKey, defaultReturnValue, defaultReturnValue, entrySet, forEach, get, getOrDefault, put, remove
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
NonNullLong2WidgetInstanceHashMap
public NonNullLong2WidgetInstanceHashMap(int expected) Creates a new hash map.The actual table size will be the least power of two greater than
expected
/DEFAULT_LOAD_FACTOR
.- Parameters:
expected
- the expected number of elements in the hash map.
-
-
Method Details
-
putAll
- Specified by:
putAll
in interfaceMap<Long,
WidgetInstance<?>> - Overrides:
putAll
in classit.unimi.dsi.fastutil.longs.AbstractLong2ObjectMap<WidgetInstance<?>>
-
put
- Specified by:
put
in interfaceit.unimi.dsi.fastutil.longs.Long2ObjectFunction<WidgetInstance<?>>
-
shiftKeys
protected final void shiftKeys(int pos) Shifts left entries with the specified hash code, starting at the specified position, and empties the resulting free entry.- Parameters:
pos
- a starting position.
-
remove
- Specified by:
remove
in interfaceit.unimi.dsi.fastutil.longs.Long2ObjectFunction<WidgetInstance<?>>
-
get
- Specified by:
get
in interfaceit.unimi.dsi.fastutil.longs.Long2ObjectFunction<WidgetInstance<?>>
-
containsKey
public boolean containsKey(long k) - Specified by:
containsKey
in interfaceit.unimi.dsi.fastutil.longs.Long2ObjectFunction<WidgetInstance<?>>
- Specified by:
containsKey
in interfaceit.unimi.dsi.fastutil.longs.Long2ObjectMap<WidgetInstance<?>>
- Overrides:
containsKey
in classit.unimi.dsi.fastutil.longs.AbstractLong2ObjectMap<WidgetInstance<?>>
-
containsValue
- Specified by:
containsValue
in interfaceMap<Long,
WidgetInstance<?>> - Overrides:
containsValue
in classit.unimi.dsi.fastutil.longs.AbstractLong2ObjectMap<WidgetInstance<?>>
-
getOrDefault
- Specified by:
getOrDefault
in interfaceit.unimi.dsi.fastutil.longs.Long2ObjectFunction<WidgetInstance<?>>
- Specified by:
getOrDefault
in interfaceit.unimi.dsi.fastutil.longs.Long2ObjectMap<WidgetInstance<?>>
-
putIfAbsent
- Specified by:
putIfAbsent
in interfaceit.unimi.dsi.fastutil.longs.Long2ObjectMap<WidgetInstance<?>>
-
remove
- Specified by:
remove
in interfaceit.unimi.dsi.fastutil.longs.Long2ObjectMap<WidgetInstance<?>>
-
replace
- Specified by:
replace
in interfaceit.unimi.dsi.fastutil.longs.Long2ObjectMap<WidgetInstance<?>>
-
replace
- Specified by:
replace
in interfaceit.unimi.dsi.fastutil.longs.Long2ObjectMap<WidgetInstance<?>>
-
computeIfAbsent
public WidgetInstance<?> computeIfAbsent(long k, LongFunction<? extends WidgetInstance<?>> mappingFunction) - Specified by:
computeIfAbsent
in interfaceit.unimi.dsi.fastutil.longs.Long2ObjectMap<WidgetInstance<?>>
-
computeIfAbsent
public WidgetInstance<?> computeIfAbsent(long key, it.unimi.dsi.fastutil.longs.Long2ObjectFunction<? extends WidgetInstance<?>> mappingFunction) - Specified by:
computeIfAbsent
in interfaceit.unimi.dsi.fastutil.longs.Long2ObjectMap<WidgetInstance<?>>
-
computeIfPresent
public WidgetInstance<?> computeIfPresent(long k, BiFunction<? super Long, ? super WidgetInstance<?>, ? extends WidgetInstance<?>> remappingFunction) - Specified by:
computeIfPresent
in interfaceit.unimi.dsi.fastutil.longs.Long2ObjectMap<WidgetInstance<?>>
-
compute
public WidgetInstance<?> compute(long k, BiFunction<? super Long, ? super WidgetInstance<?>, ? extends WidgetInstance<?>> remappingFunction) - Specified by:
compute
in interfaceit.unimi.dsi.fastutil.longs.Long2ObjectMap<WidgetInstance<?>>
-
merge
public WidgetInstance<?> merge(long k, WidgetInstance<?> v, BiFunction<? super WidgetInstance<?>, ? super WidgetInstance<?>, ? extends WidgetInstance<?>> remappingFunction) - Specified by:
merge
in interfaceit.unimi.dsi.fastutil.longs.Long2ObjectMap<WidgetInstance<?>>
-
clear
public void clear()- Specified by:
clear
in interfaceit.unimi.dsi.fastutil.Function<Long,
WidgetInstance<?>> - Specified by:
clear
in interfaceit.unimi.dsi.fastutil.longs.Long2ObjectMap<WidgetInstance<?>>
- Specified by:
clear
in interfaceMap<Long,
WidgetInstance<?>>
-
size
public int size()- Specified by:
size
in interfaceit.unimi.dsi.fastutil.Function<Long,
WidgetInstance<?>> - Specified by:
size
in interfaceit.unimi.dsi.fastutil.longs.Long2ObjectMap<WidgetInstance<?>>
- Specified by:
size
in interfaceMap<Long,
WidgetInstance<?>>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceMap<Long,
WidgetInstance<?>> - Overrides:
isEmpty
in classit.unimi.dsi.fastutil.longs.AbstractLong2ObjectMap<WidgetInstance<?>>
-
forEachValue
-
long2ObjectEntrySet
public it.unimi.dsi.fastutil.longs.Long2ObjectMap.FastEntrySet<WidgetInstance<?>> long2ObjectEntrySet()- Specified by:
long2ObjectEntrySet
in interfaceit.unimi.dsi.fastutil.longs.Long2ObjectMap<WidgetInstance<?>>
-
keySet
public it.unimi.dsi.fastutil.longs.LongSet keySet()- Specified by:
keySet
in interfaceit.unimi.dsi.fastutil.longs.Long2ObjectMap<WidgetInstance<?>>
- Specified by:
keySet
in interfaceMap<Long,
WidgetInstance<?>> - Overrides:
keySet
in classit.unimi.dsi.fastutil.longs.AbstractLong2ObjectMap<WidgetInstance<?>>
-
values
- Specified by:
values
in interfaceit.unimi.dsi.fastutil.longs.Long2ObjectMap<WidgetInstance<?>>
- Specified by:
values
in interfaceMap<Long,
WidgetInstance<?>> - Overrides:
values
in classit.unimi.dsi.fastutil.longs.AbstractLong2ObjectMap<WidgetInstance<?>>
-
trim
public boolean trim()Rehashes the map, making the table as small as possible.This method rehashes the table to the smallest size satisfying the load factor. It can be used when the set will not be changed anymore, so to optimize access speed and size.
If the table size is already the minimum possible, this method does nothing.
- Returns:
- true if there was enough memory to trim the map.
- See Also:
-
trim
public boolean trim(int n) Rehashes this map if the table is too large.Let N be the smallest table size that can hold
max(n,
entries, still satisfying the load factor. If the current table size is smaller than or equal to N, this method does nothing. Otherwise, it rehashes this map in a table of size N.size()
)This method is useful when reusing maps. Clearing a map leaves the table size untouched. If you are reusing a map many times, you can call this method with a typical size to avoid keeping around a very large table just because of a few large transient maps.
- Parameters:
n
- the threshold for the trimming.- Returns:
- true if there was enough memory to trim the map.
- See Also:
-
rehash
protected void rehash(int newN) Rehashes the map.This method implements the basic rehashing strategy, and may be overridden by subclasses implementing different rehashing strategies (e.g., disk-based rehashing). However, you should not override this method unless you understand the internal workings of this class.
- Parameters:
newN
- the new size
-
clone
Returns a deep copy of this map.This method performs a deep copy of this hash map; the data stored in the map, however, is not cloned. Note that this makes a difference only for object keys.
-
equals
- Specified by:
equals
in interfaceMap<Long,
WidgetInstance<?>> - Overrides:
equals
in classit.unimi.dsi.fastutil.longs.AbstractLong2ObjectMap<WidgetInstance<?>>
-
hashCode
public int hashCode()Returns a hash code for this map. This method overrides the generic method provided by the superclass. Sinceequals()
is not overriden, it is important that the value returned by this method is the same value as the one returned by the overriden method.- Specified by:
hashCode
in interfaceMap<Long,
WidgetInstance<?>> - Overrides:
hashCode
in classit.unimi.dsi.fastutil.longs.AbstractLong2ObjectMap<WidgetInstance<?>>
- Returns:
- a hash code for this map.
-