MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / MapEntry

Class MapEntry

Ports/CLDC11/src/java/util/MapEntry.java:21–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected