(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)
| 503 | } |
| 504 | |
| 505 | private static <K, V> void doDifference(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) { |
| 506 | for (Entry<? extends K, ? extends V> entry : left.entrySet()) { |
| 507 | K leftKey = entry.getKey(); |
| 508 | V leftValue = entry.getValue(); |
| 509 | if (right.containsKey(leftKey)) { |
| 510 | V rightValue = onlyOnRight.remove(leftKey); |
| 511 | if (valueEquivalence.equivalent(leftValue, rightValue)) { |
| 512 | onBoth.put(leftKey, leftValue); |
| 513 | } else { |
| 514 | differences.put(leftKey, ValueDifferenceImpl.create(leftValue, rightValue)); |
| 515 | } |
| 516 | } else { |
| 517 | onlyOnLeft.put(leftKey, leftValue); |
| 518 | } |
| 519 | } |
| 520 | } |
| 521 | |
| 522 | private static <K, V> Map<K, V> unmodifiableMap(Map<K, ? extends V> map) { |
| 523 | if (map instanceof SortedMap) { |
no test coverage detected