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