de.caff.generics

## Class Dict.Entry<EK,EV>

- java.lang.Object
- - de.caff.generics.Dict.Entry<EK,EV>

- All Implemented Interfaces:
    ITuple2<EK,EV>
  Enclosing interface:
    Dict<K,V>

      public abstract static class Dict.Entry<EK,EV>
      extends java.lang.Object
      implements ITuple2<EK,EV>

  Entry access. This provides the basic methods `toString()`, `equals(Object)`, and `hashCode()`.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface de.caff.generics.tuple.ITuple2

      `ITuple2.Base<T1,T2>`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Entry()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `EK` | `_1()` Get the first element.
    `EV` | `_2()` Get the second element.
    `boolean` | `equals(java.lang.Object o)`
    `abstract EK` | `getKey()` Get the key.
    `EV` | `getNonNullValue()` Get the value, but make sure it is not `null`.
    `abstract EV` | `getValue()` Get the value.
    `EV` | `getValueOrDefault(EV defaultValue)` Get the value, or a default.
    `int` | `hashCode()`
    `<NEK> Dict.Entry<NEK,EV>` | `keyView(java.util.function.Function<? super EK,? extends NEK> keyMapper)` View this entry as if it has another key.
    `java.lang.String` | `toString()`
    `<NEV> Dict.Entry<EK,NEV>` | `valueView(java.util.function.Function<? super EV,? extends NEV> valueMapper)` View this entry as if it has a different value type.
    `static <KT,VT> Dict.Entry<KT,VT>` | `view(KT key, VT value)` View a pair of key and value as an entry.
    `static <MEK,MEV> Dict.Entry<MEK,MEV>` | `viewMapEntry(java.util.Map.Entry<? extends MEK,? extends MEV> mapEntry)`
    `<NEK,NEV> Dict.Entry<NEK,NEV>` | `viewMapped(java.util.function.Function<? super EK,? extends NEK> keyMapper, java.util.function.Function<? super EV,? extends NEV> valueMapper)` View this entry as if it has a different value.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface de.caff.generics.tuple.ITuple2

      `_21, asBase, concat1, concat2, concat3, concat4, concat5, concat6, concat7, concat8, concatPred1, concatPred2, concatPred3, concatPred4, concatPred5, concatPred6, concatPred7, concatPred8, concatProc1, concatProc2, concatProc3, concatProc4, concatProc5, concatProc6, concatProc7, concatProc8, equals, frozen, frozenNotNull, hash, invoke, sendTo, testBy, toString, toString`

- - ### Constructor Detail

    - #### Entry

          public Entry()

  - ### Method Detail

    - #### getKey

          public abstract EK getKey()

      Get the key.
      Returns:
        key

    - #### getValue

          public abstract EV getValue()

      Get the value.
      Returns:
        value

    - #### getNonNullValue

          @NotNull
          public EV getNonNullValue()

      Get the value, but make sure it is not `null`. Depending on the underlying mapping `null` values might be acceptable, but will result in an exception nevertheless.
      Returns:
        non-null value associated with getKey()
      Throws:
        `java.lang.NullPointerException` - if the return value would have been `null`
      See Also:
        `getValueOrDefault(Object)`

    - #### getValueOrDefault

          @NotNull
          public EV getValueOrDefault(@NotNull
                                               EV defaultValue)

      Get the value, or a default. Return a default if the associated value is `null`.
      Parameters:
        `defaultValue` - default value used as fallback
      Returns:
        associated value or `defaultValue`

    - #### _1

          public EK _1()

      Description copied from interface: `ITuple2`
      Get the first element.
      Specified by:
        `_1` in interface `ITuple2<EK,EV>`
      Returns:
        first element

    - #### _2

          public EV _2()

      Description copied from interface: `ITuple2`
      Get the second element.
      Specified by:
        `_2` in interface `ITuple2<EK,EV>`
      Returns:
        second element

    - #### keyView

          @NotNull
          public <NEK> Dict.Entry<NEK,EV> keyView(@NotNull
                                                           java.util.function.Function<? super EK,? extends NEK> keyMapper)

      View this entry as if it has another key.
      Type Parameters:
        `NEK` - new key type
      Parameters:
        `keyMapper` - mapper from internal key to expected key
      Returns:
        entry with adapted key and same value

    - #### valueView

          @NotNull
          public <NEV> Dict.Entry<EK,NEV> valueView(@NotNull
                                                             java.util.function.Function<? super EV,? extends NEV> valueMapper)

      View this entry as if it has a different value type.
      Type Parameters:
        `NEV` - new value type
      Parameters:
        `valueMapper` - mapper from internal to expected value
      Returns:
        entry with same key and adapted value

    - #### viewMapped

          @NotNull
          public <NEK,NEV> Dict.Entry<NEK,NEV> viewMapped(@NotNull
                                                                   java.util.function.Function<? super EK,? extends NEK> keyMapper,
                                                                   @NotNull
                                                                   java.util.function.Function<? super EV,? extends NEV> valueMapper)

      View this entry as if it has a different value.
      Type Parameters:
        `NEK` - returned key type
        `NEV` - returned value type
      Parameters:
        `keyMapper` - mapper from internal to expected key type
        `valueMapper` - mapper from internal to expected value type
      Returns:
        entry with different key and different value

    - #### toString

          @NotNull
          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### equals

          public boolean equals(java.lang.Object o)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### view

          @NotNull
          public static <KT,VT> Dict.Entry<KT,VT> view(KT key,
                                                                @NotNull
                                                                VT value)

      View a pair of key and value as an entry.
      Specified by:
        `view` in interface `ITuple2<EK,EV>`
      Type Parameters:
        `KT` - key type
        `VT` - value type
      Parameters:
        `key` - key
        `value` - value
      Returns:
        entry with given key and value

    - #### viewMapEntry

          @NotNull
          public static <MEK,MEV> Dict.Entry<MEK,MEV> viewMapEntry(@NotNull
                                                                            java.util.Map.Entry<? extends MEK,? extends MEV> mapEntry)