empty map entry java

Solutions on MaxInterview for empty map entry java by the best coders in the world

showing results for - "empty map entry java"
Erine
07 Nov 2018
1import java.util.Map;
2
3final class MyEntry<K, V> implements Map.Entry<K, V> {
4    private final K key;
5    private V value;
6
7    public MyEntry(K key, V value) {
8        this.key = key;
9        this.value = value;
10    }
11
12    @Override
13    public K getKey() {
14        return key;
15    }
16
17    @Override
18    public V getValue() {
19        return value;
20    }
21
22    @Override
23    public V setValue(V value) {
24        V old = this.value;
25        this.value = value;
26        return old;
27    }
28}
29
similar questions
queries leading to this page
empty map entry java