MapEntryParameter (Oracle - Berkeley DB Java API)
Date: 2017-04-13

com.sleepycat.collections

## Class MapEntryParameter<K,V>

- java.lang.Object
- - com.sleepycat.collections.MapEntryParameter<K,V>

- All Implemented Interfaces:
    java.util.Map.Entry<K,V>

      public class MapEntryParameter<K,V>
      extends java.lang.Object
      implements java.util.Map.Entry<K,V>

  A simple `Map.Entry` implementation that can be used as in input parameter. Since a `MapEntryParameter` is not obtained from a map, it is not attached to any map in particular. To emphasize that changing this object does not change the map, the `setValue(V)` method always throws `UnsupportedOperationException`.

  Warning: Use of this interface violates the Java Collections interface contract since these state that `Map.Entry` objects should only be obtained from `Map.entrySet()` sets, while this class allows constructing them directly. However, it is useful for performing operations on an entry set such as add(), contains(), etc. For restrictions see `getValue()` and `setValue(V)`.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MapEntryParameter(K key, V value)` Creates a map entry with a given key and value.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(java.lang.Object other)` Compares this entry to a given entry as specified by `Map.Entry.equals(java.lang.Object)`.
    `K` | `getKey()` Returns the key of this entry.
    `V` | `getValue()` Returns the value of this entry.
    `int` | `hashCode()` Computes a hash code as specified by `Map.Entry.hashCode()`.
    `V` | `setValue(V newValue)` Always throws `UnsupportedOperationException` since this object is not attached to a map.
    `java.lang.String` | `toString()` Converts the entry to a string representation for debugging.

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

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

    - ### Methods inherited from interface java.util.Map.Entry

      `comparingByKey, comparingByKey, comparingByValue, comparingByValue`

- - ### Constructor Detail

    - #### MapEntryParameter

          public MapEntryParameter(K key,
                                   V value)

      Creates a map entry with a given key and value.
      Parameters:
        `key` - is the key to use.
        `value` - is the value to use.

  - ### Method Detail

    - #### hashCode

          public int hashCode()

      Computes a hash code as specified by `Map.Entry.hashCode()`.
      Specified by:
        `hashCode` in interface `java.util.Map.Entry<K,V>`
      Overrides:
        `hashCode` in class `java.lang.Object`
      Returns:
        the computed hash code.

    - #### equals

          public boolean equals(java.lang.Object other)

      Compares this entry to a given entry as specified by `Map.Entry.equals(java.lang.Object)`.
      Specified by:
        `equals` in interface `java.util.Map.Entry<K,V>`
      Overrides:
        `equals` in class `java.lang.Object`
      Returns:
        the computed hash code.

    - #### getKey

          public final K getKey()

      Returns the key of this entry.
      Specified by:
        `getKey` in interface `java.util.Map.Entry<K,V>`
      Returns:
        the key of this entry.

    - #### getValue

          public final V getValue()

      Returns the value of this entry. Note that this will be the value passed to the constructor or the last value passed to `setValue(V)`. It will not reflect changes made to a Map.
      Specified by:
        `getValue` in interface `java.util.Map.Entry<K,V>`
      Returns:
        the value of this entry.

    - #### setValue

          public V setValue(V newValue)

      Always throws `UnsupportedOperationException` since this object is not attached to a map.
      Specified by:
        `setValue` in interface `java.util.Map.Entry<K,V>`

    - #### toString

          public java.lang.String toString()

      Converts the entry to a string representation for debugging.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        the string representation.

Copyright (c) 1996, 2017 Oracle and/or its affiliates. All rights reserved.