Class Short2ReferenceFunctions.Singleton<V>

java.lang.Object
it.unimi.dsi.fastutil.shorts.AbstractShort2ReferenceFunction<V>
it.unimi.dsi.fastutil.shorts.Short2ReferenceFunctions.Singleton<V>
All Implemented Interfaces:
it.unimi.dsi.fastutil.Function<Short,V>, it.unimi.dsi.fastutil.shorts.Short2ReferenceFunction<V>, Serializable, Cloneable, Function<Short,V>, IntFunction<V>
Direct Known Subclasses:
Short2ReferenceMaps.Singleton
Enclosing class:
Short2ReferenceFunctions

public static class Short2ReferenceFunctions.Singleton<V> extends AbstractShort2ReferenceFunction<V> implements Serializable, Cloneable
An immutable class representing a type-specific singleton function. Note that the default return value is still settable.

Note that albeit the function is immutable, its default return value may be changed.

This class may be useful to implement your own in case you subclass a type-specific function.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final short
     
    protected final V
     

    Fields inherited from class it.unimi.dsi.fastutil.shorts.AbstractShort2ReferenceFunction

    defRetValue
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Singleton(short key, V value)
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    boolean
    containsKey(short k)
     
    get(short k)
     
    getOrDefault(short k, V defaultValue)
     
    int
     

    Methods inherited from class it.unimi.dsi.fastutil.shorts.AbstractShort2ReferenceFunction

    defaultReturnValue, defaultReturnValue

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface it.unimi.dsi.fastutil.Function

    apply, clear

    Methods inherited from interface java.util.function.Function

    andThen

    Methods inherited from interface it.unimi.dsi.fastutil.shorts.Short2ReferenceFunction

    andThenByte, andThenChar, andThenDouble, andThenFloat, andThenInt, andThenLong, andThenObject, andThenReference, andThenShort, apply, compose, composeByte, composeChar, composeDouble, composeFloat, composeInt, composeLong, composeObject, composeReference, composeShort, containsKey, get, getOrDefault, put, put, remove, remove
  • Field Details

    • key

      protected final short key
    • value

      protected final V value
  • Constructor Details

    • Singleton

      protected Singleton(short key, V value)
  • Method Details

    • containsKey

      public boolean containsKey(short k)
      Specified by:
      containsKey in interface it.unimi.dsi.fastutil.shorts.Short2ReferenceFunction<V>
    • get

      public V get(short k)
      Specified by:
      get in interface it.unimi.dsi.fastutil.shorts.Short2ReferenceFunction<V>
    • getOrDefault

      public V getOrDefault(short k, V defaultValue)
      Specified by:
      getOrDefault in interface it.unimi.dsi.fastutil.shorts.Short2ReferenceFunction<V>
    • size

      public int size()
      Specified by:
      size in interface it.unimi.dsi.fastutil.Function<Short,V>
    • clone

      public Object clone()
      Overrides:
      clone in class Object