MCPcopy Index your code
hub / github.com/davidgiven/luje / equals

Method equals

lib/java/util/AbstractMap.java:125–157  ·  view source on GitHub ↗

Compares the specified object to this instance, and returns true if the specified object is a map and both maps contain the same mappings. @param object the object to compare with this object. @return boolean true if the object is the same as this object, and {@co

(Object object)

Source from the content-addressed store, hash-verified

123 * @see #entrySet()
124 */
125 @Override
126 public boolean equals(Object object) {
127 if (this == object) {
128 return true;
129 }
130 if (object instanceof Map) {
131 Map<?, ?> map = (Map<?, ?>) object;
132 if (size() != map.size()) {
133 return false;
134 }
135
136 try {
137 for (Entry<K, V> entry : entrySet()) {
138 K key = entry.getKey();
139 V mine = entry.getValue();
140 Object theirs = map.get(key);
141 if (mine == null) {
142 if (theirs != null || !map.containsKey(key)) {
143 return false;
144 }
145 } else if (!mine.equals(theirs)) {
146 return false;
147 }
148 }
149 } catch (NullPointerException ignored) {
150 return false;
151 } catch (ClassCastException ignored) {
152 return false;
153 }
154 return true;
155 }
156 return false;
157 }
158
159 /**
160 * Returns the value of the mapping with the specified key.

Callers

nothing calls this directly

Calls 8

sizeMethod · 0.95
entrySetMethod · 0.95
sizeMethod · 0.65
getKeyMethod · 0.65
getValueMethod · 0.65
getMethod · 0.65
containsKeyMethod · 0.65
equalsMethod · 0.65

Tested by

no test coverage detected