MCPcopy Create free account
hub / github.com/antlr/codebuff / doDifference

Method doDifference

corpus/java/training/guava/collect/Maps.java:473–495  ·  view source on GitHub ↗
(
      Map<? extends K, ? extends V> left,
      Map<? extends K, ? extends V> right,
      Equivalence<? super V> valueEquivalence,
      Map<K, V> onlyOnLeft,
      Map<K, V> onlyOnRight,
      Map<K, V> onBoth,
      Map<K, MapDifference.ValueDifference<V>> differences)

Source from the content-addressed store, hash-verified

471 }
472
473 private static <K, V> void doDifference(
474 Map<? extends K, ? extends V> left,
475 Map<? extends K, ? extends V> right,
476 Equivalence<? super V> valueEquivalence,
477 Map<K, V> onlyOnLeft,
478 Map<K, V> onlyOnRight,
479 Map<K, V> onBoth,
480 Map<K, MapDifference.ValueDifference<V>> differences) {
481 for (Entry<? extends K, ? extends V> entry : left.entrySet()) {
482 K leftKey = entry.getKey();
483 V leftValue = entry.getValue();
484 if (right.containsKey(leftKey)) {
485 V rightValue = onlyOnRight.remove(leftKey);
486 if (valueEquivalence.equivalent(leftValue, rightValue)) {
487 onBoth.put(leftKey, leftValue);
488 } else {
489 differences.put(leftKey, ValueDifferenceImpl.create(leftValue, rightValue));
490 }
491 } else {
492 onlyOnLeft.put(leftKey, leftValue);
493 }
494 }
495 }
496
497 private static <K, V> Map<K, V> unmodifiableMap(Map<K, ? extends V> map) {
498 if (map instanceof SortedMap) {

Callers 1

differenceMethod · 0.95

Calls 8

createMethod · 0.95
entrySetMethod · 0.65
getKeyMethod · 0.65
getValueMethod · 0.65
containsKeyMethod · 0.65
removeMethod · 0.65
putMethod · 0.65
equivalentMethod · 0.45

Tested by

no test coverage detected