Class NonNullLong2WidgetInstanceHashMap

java.lang.Object
it.unimi.dsi.fastutil.longs.AbstractLong2ObjectFunction<WidgetInstance<?>>
it.unimi.dsi.fastutil.longs.AbstractLong2ObjectMap<WidgetInstance<?>>
dev.pfaff.altargui.util.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<?>>

public final class NonNullLong2WidgetInstanceHashMap extends it.unimi.dsi.fastutil.longs.AbstractLong2ObjectMap<WidgetInstance<?>> implements Cloneable, it.unimi.dsi.fastutil.Hash
See Also:
  • 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

      public void putAll(Map<? extends Long,? extends WidgetInstance<?>> m)
      Specified by:
      putAll in interface Map<Long,WidgetInstance<?>>
      Overrides:
      putAll in class it.unimi.dsi.fastutil.longs.AbstractLong2ObjectMap<WidgetInstance<?>>
    • put

      public WidgetInstance<?> put(long k, WidgetInstance<?> v)
      Specified by:
      put in interface it.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

      public WidgetInstance<?> remove(long k)
      Specified by:
      remove in interface it.unimi.dsi.fastutil.longs.Long2ObjectFunction<WidgetInstance<?>>
    • get

      public WidgetInstance<?> get(long k)
      Specified by:
      get in interface it.unimi.dsi.fastutil.longs.Long2ObjectFunction<WidgetInstance<?>>
    • containsKey

      public boolean containsKey(long k)
      Specified by:
      containsKey in interface it.unimi.dsi.fastutil.longs.Long2ObjectFunction<WidgetInstance<?>>
      Specified by:
      containsKey in interface it.unimi.dsi.fastutil.longs.Long2ObjectMap<WidgetInstance<?>>
      Overrides:
      containsKey in class it.unimi.dsi.fastutil.longs.AbstractLong2ObjectMap<WidgetInstance<?>>
    • containsValue

      public boolean containsValue(Object v)
      Specified by:
      containsValue in interface Map<Long,WidgetInstance<?>>
      Overrides:
      containsValue in class it.unimi.dsi.fastutil.longs.AbstractLong2ObjectMap<WidgetInstance<?>>
    • getOrDefault

      public WidgetInstance<?> getOrDefault(long k, WidgetInstance<?> defaultValue)
      Specified by:
      getOrDefault in interface it.unimi.dsi.fastutil.longs.Long2ObjectFunction<WidgetInstance<?>>
      Specified by:
      getOrDefault in interface it.unimi.dsi.fastutil.longs.Long2ObjectMap<WidgetInstance<?>>
    • putIfAbsent

      public WidgetInstance<?> putIfAbsent(long k, WidgetInstance<?> v)
      Specified by:
      putIfAbsent in interface it.unimi.dsi.fastutil.longs.Long2ObjectMap<WidgetInstance<?>>
    • remove

      public boolean remove(long k, Object v)
      Specified by:
      remove in interface it.unimi.dsi.fastutil.longs.Long2ObjectMap<WidgetInstance<?>>
    • replace

      public boolean replace(long k, WidgetInstance<?> oldValue, WidgetInstance<?> v)
      Specified by:
      replace in interface it.unimi.dsi.fastutil.longs.Long2ObjectMap<WidgetInstance<?>>
    • replace

      public WidgetInstance<?> replace(long k, WidgetInstance<?> v)
      Specified by:
      replace in interface it.unimi.dsi.fastutil.longs.Long2ObjectMap<WidgetInstance<?>>
    • computeIfAbsent

      public WidgetInstance<?> computeIfAbsent(long k, LongFunction<? extends WidgetInstance<?>> mappingFunction)
      Specified by:
      computeIfAbsent in interface it.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 interface it.unimi.dsi.fastutil.longs.Long2ObjectMap<WidgetInstance<?>>
    • computeIfPresent

      public WidgetInstance<?> computeIfPresent(long k, BiFunction<? super Long,? super WidgetInstance<?>,? extends WidgetInstance<?>> remappingFunction)
      Specified by:
      computeIfPresent in interface it.unimi.dsi.fastutil.longs.Long2ObjectMap<WidgetInstance<?>>
    • compute

      public WidgetInstance<?> compute(long k, BiFunction<? super Long,? super WidgetInstance<?>,? extends WidgetInstance<?>> remappingFunction)
      Specified by:
      compute in interface it.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 interface it.unimi.dsi.fastutil.longs.Long2ObjectMap<WidgetInstance<?>>
    • clear

      public void clear()
      Specified by:
      clear in interface it.unimi.dsi.fastutil.Function<Long,WidgetInstance<?>>
      Specified by:
      clear in interface it.unimi.dsi.fastutil.longs.Long2ObjectMap<WidgetInstance<?>>
      Specified by:
      clear in interface Map<Long,WidgetInstance<?>>
    • size

      public int size()
      Specified by:
      size in interface it.unimi.dsi.fastutil.Function<Long,WidgetInstance<?>>
      Specified by:
      size in interface it.unimi.dsi.fastutil.longs.Long2ObjectMap<WidgetInstance<?>>
      Specified by:
      size in interface Map<Long,WidgetInstance<?>>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Map<Long,WidgetInstance<?>>
      Overrides:
      isEmpty in class it.unimi.dsi.fastutil.longs.AbstractLong2ObjectMap<WidgetInstance<?>>
    • forEachValue

      public void forEachValue(WidgetInstanceConsumer consumer)
    • long2ObjectEntrySet

      public it.unimi.dsi.fastutil.longs.Long2ObjectMap.FastEntrySet<WidgetInstance<?>> long2ObjectEntrySet()
      Specified by:
      long2ObjectEntrySet in interface it.unimi.dsi.fastutil.longs.Long2ObjectMap<WidgetInstance<?>>
    • keySet

      public it.unimi.dsi.fastutil.longs.LongSet keySet()
      Specified by:
      keySet in interface it.unimi.dsi.fastutil.longs.Long2ObjectMap<WidgetInstance<?>>
      Specified by:
      keySet in interface Map<Long,WidgetInstance<?>>
      Overrides:
      keySet in class it.unimi.dsi.fastutil.longs.AbstractLong2ObjectMap<WidgetInstance<?>>
    • values

      public it.unimi.dsi.fastutil.objects.ObjectCollection<WidgetInstance<?>> values()
      Specified by:
      values in interface it.unimi.dsi.fastutil.longs.Long2ObjectMap<WidgetInstance<?>>
      Specified by:
      values in interface Map<Long,WidgetInstance<?>>
      Overrides:
      values in class it.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,size()) 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.

      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.

      Overrides:
      clone in class Object
      Returns:
      a deep copy of this map.
    • equals

      public boolean equals(Object o)
      Specified by:
      equals in interface Map<Long,WidgetInstance<?>>
      Overrides:
      equals in class it.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. Since equals() 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 interface Map<Long,WidgetInstance<?>>
      Overrides:
      hashCode in class it.unimi.dsi.fastutil.longs.AbstractLong2ObjectMap<WidgetInstance<?>>
      Returns:
      a hash code for this map.