Interface Reference2ReferenceFunction<K,​V>

    • Method Summary

      Modifier and Type Method Description
      default V defaultReturnValue()
      Gets the default return value.
      default void defaultReturnValue​(V rv)
      Sets the default return value (optional operation).
      V get​(Object key)
      Returns the value to which the given key is mapped.
      default V put​(K key, V value)
      Adds a pair to the map (optional operation).
      default V remove​(Object key)
      Removes the mapping with the given key (optional operation).
    • Method Detail

      • put

        default V put​(K key,
                      V value)
        Adds a pair to the map (optional operation).
        Specified by:
        put in interface Function<K,​V>
        Parameters:
        key - the key.
        value - the value.
        Returns:
        the old value, or the default return value if no value was present for the given key.
        See Also:
        Function.put(Object,Object)
      • defaultReturnValue

        default void defaultReturnValue​(V rv)
        Sets the default return value (optional operation). This value must be returned by type-specific versions of get(), put() and remove() to denote that the map does not contain the specified key. It must be 0/false/null by default.
        Parameters:
        rv - the new default return value.
        See Also:
        defaultReturnValue()
      • defaultReturnValue

        default V defaultReturnValue()
        Gets the default return value.

        This default implementation just return the default null value of the type (null for objects, 0 for scalars, false for Booleans).

        Returns:
        the current default return value.