public interface Mapping<K,V>
Modifier and Type | Method and Description |
---|---|
default boolean |
defined(K k) |
V |
get(K k)
Returns the value associated with a given key, throwing a
NoSuchElementException if no value is currently associated
with the given key.
|
V |
remove(K k)
Removes the ordered pair with a given input key k, returning a
NoSuchElementException and leaving the Mapping unchanged if no
such ordered pair exists.
|
void |
set(K k,
V v)
Sets the value associated with an input key to be an input
value — replacing the value formerly associated with
this key if one already exists.
|
V get(K k) throws java.util.NoSuchElementException
k
- the key whose value is to be returnedjava.util.NoSuchElementException
- if no value is defined for this key
default boolean defined(K k)
k
- the key to be searched forvoid set(K k, V v)
k
- the key for which a value is to be definedv
- the value that is to be defined to this key
V remove(K k) throws java.util.NoSuchElementException
k
- the key for which a value is to be undefinedjava.util.NoSuchElementException
- if no value was defined for this key