MapEntry is an internal class which provides an implementation of Map.Entry.
| 21 | * MapEntry is an internal class which provides an implementation of Map.Entry. |
| 22 | */ |
| 23 | class MapEntry<K, V> implements Map.Entry<K, V> { |
| 24 | |
| 25 | K key; |
| 26 | V value; |
| 27 | |
| 28 | interface Type<RT, KT, VT> { |
| 29 | RT get(MapEntry<KT, VT> entry); |
| 30 | } |
| 31 | |
| 32 | MapEntry(K theKey) { |
| 33 | key = theKey; |
| 34 | } |
| 35 | |
| 36 | MapEntry(K theKey, V theValue) { |
| 37 | key = theKey; |
| 38 | value = theValue; |
| 39 | } |
| 40 | |
| 41 | @Override |
| 42 | public boolean equals(Object object) { |
| 43 | if (this == object) { |
| 44 | return true; |
| 45 | } |
| 46 | if (object instanceof Map.Entry) { |
| 47 | Map.Entry<?, ?> entry = (Map.Entry<?, ?>) object; |
| 48 | return (key == null ? entry.getKey() == null : key.equals(entry |
| 49 | .getKey())) |
| 50 | && (value == null ? entry.getValue() == null : value |
| 51 | .equals(entry.getValue())); |
| 52 | } |
| 53 | return false; |
| 54 | } |
| 55 | |
| 56 | public K getKey() { |
| 57 | return key; |
| 58 | } |
| 59 | |
| 60 | public V getValue() { |
| 61 | return value; |
| 62 | } |
| 63 | |
| 64 | @Override |
| 65 | public int hashCode() { |
| 66 | return (key == null ? 0 : key.hashCode()) |
| 67 | ^ (value == null ? 0 : value.hashCode()); |
| 68 | } |
| 69 | |
| 70 | public V setValue(V object) { |
| 71 | V result = value; |
| 72 | value = object; |
| 73 | return result; |
| 74 | } |
| 75 | |
| 76 | @Override |
| 77 | public String toString() { |
| 78 | return key + "=" + value; |
| 79 | } |
| 80 | } |
nothing calls this directly
no outgoing calls
no test coverage detected