Class MapDifference<K,V>
- java.lang.Object
-
- com.github.toolarium.common.compare.map.impl.MapDifference<K,V>
-
- All Implemented Interfaces:
IMapDifference<K,V>
- Direct Known Subclasses:
SortedMapDifference
public class MapDifference<K,V> extends java.lang.Object implements IMapDifference<K,V>
Implements theIMapDifference.
-
-
Constructor Summary
Constructors Constructor Description MapDifference(java.util.Map<K,V> onlyOnLeft, java.util.Map<K,V> onlyOnRight, java.util.Map<K,V> onBoth, java.util.Map<K,IValueDifference<V>> differences)Constructor for MapDifference
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanareEqual()Returnstrueif there are no differences between the two maps; that is, if the maps are equal.java.util.Map<K,IValueDifference<V>>entriesDiffering()Returns a map describing keys that appear in both maps, but with different values.java.util.Map<K,V>entriesInCommon()Returns a map containing the entries that appear in both maps; that is, the intersection of the two maps.java.util.Map<K,V>entriesOnlyOnLeft()Returns a map containing the entries from the left map whose keys are not present in the right map.java.util.Map<K,V>entriesOnlyOnRight()Returns a map containing the entries from the right map whose keys are not present in the left map.booleanequals(java.lang.Object obj)inthashCode()java.lang.StringtoString()
-
-
-
Constructor Detail
-
MapDifference
public MapDifference(java.util.Map<K,V> onlyOnLeft, java.util.Map<K,V> onlyOnRight, java.util.Map<K,V> onBoth, java.util.Map<K,IValueDifference<V>> differences)
Constructor for MapDifference- Parameters:
onlyOnLeft- only on left sideonlyOnRight- only on right sideonBoth- on both sidedifferences- the differences
-
-
Method Detail
-
areEqual
public boolean areEqual()
Description copied from interface:IMapDifferenceReturnstrueif there are no differences between the two maps; that is, if the maps are equal.- Specified by:
areEqualin interfaceIMapDifference<K,V>- Returns:
- true if they are equal
- See Also:
IMapDifference.areEqual()
-
entriesOnlyOnLeft
public java.util.Map<K,V> entriesOnlyOnLeft()
Description copied from interface:IMapDifferenceReturns a map containing the entries from the left map whose keys are not present in the right map.- Specified by:
entriesOnlyOnLeftin interfaceIMapDifference<K,V>- Returns:
- map containing the entries from the left map whose keys are not present in the right map
- See Also:
IMapDifference.entriesOnlyOnLeft()
-
entriesOnlyOnRight
public java.util.Map<K,V> entriesOnlyOnRight()
Description copied from interface:IMapDifferenceReturns a map containing the entries from the right map whose keys are not present in the left map.- Specified by:
entriesOnlyOnRightin interfaceIMapDifference<K,V>- Returns:
- map containing the entries from the right map whose keys are not present in the left map
- See Also:
IMapDifference.entriesOnlyOnRight()
-
entriesInCommon
public java.util.Map<K,V> entriesInCommon()
Description copied from interface:IMapDifferenceReturns a map containing the entries that appear in both maps; that is, the intersection of the two maps.- Specified by:
entriesInCommonin interfaceIMapDifference<K,V>- Returns:
- map containing the entries that appear in both maps; that is, the intersection of the two maps
- See Also:
IMapDifference.entriesInCommon()
-
entriesDiffering
public java.util.Map<K,IValueDifference<V>> entriesDiffering()
Description copied from interface:IMapDifferenceReturns a map describing keys that appear in both maps, but with different values.- Specified by:
entriesDifferingin interfaceIMapDifference<K,V>- Returns:
- map describing keys that appear in both maps, but with different values.
- See Also:
IMapDifference.entriesDiffering()
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object- See Also:
Object.equals(java.lang.Object)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object- See Also:
Object.hashCode()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- See Also:
Object.toString()
-
-