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

Method equals

Ports/CLDC11/src/java/util/AbstractMap.java:368–402  ·  view source on GitHub ↗
(Object object)

Source from the content-addressed store, hash-verified

366 ///
367 /// - #entrySet()
368 @Override
369 public boolean equals(Object object) {
370 if (this == object) {
371 return true;
372 }
373 if (object instanceof Map) {
374 Map<?, ?> map = (Map<?, ?>) object;
375 if (size() != map.size()) {
376 return false;
377 }
378
379 try {
380 Iterator<Entry<K, V>> it = entrySet().iterator();
381 while (it.hasNext()) {
382 Entry<K, V> entry = it.next();
383 K key = entry.getKey();
384 V mine = entry.getValue();
385 Object theirs = map.get(key);
386 if (mine == null) {
387 if (theirs != null || !map.containsKey(key)) {
388 return false;
389 }
390 } else if (!mine.equals(theirs)) {
391 return false;
392 }
393 }
394 } catch (NullPointerException ignored) {
395 return false;
396 } catch (ClassCastException ignored) {
397 return false;
398 }
399 return true;
400 }
401 return false;
402 }
403
404 /// Returns the value of the mapping with the specified key.
405 ///

Callers

nothing calls this directly

Calls 11

sizeMethod · 0.95
entrySetMethod · 0.95
sizeMethod · 0.65
iteratorMethod · 0.65
hasNextMethod · 0.65
nextMethod · 0.65
getKeyMethod · 0.65
getValueMethod · 0.65
getMethod · 0.65
containsKeyMethod · 0.65
equalsMethod · 0.65

Tested by

no test coverage detected