Package com.google.common.collect
Class Maps.MapDifferenceImpl<K,V>
- java.lang.Object
-
- com.google.common.collect.Maps.MapDifferenceImpl<K,V>
-
- All Implemented Interfaces:
MapDifference<K,V>
- Direct Known Subclasses:
Maps.SortedMapDifferenceImpl
- Enclosing class:
- Maps
static class Maps.MapDifferenceImpl<K,V> extends java.lang.Object implements MapDifference<K,V>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.google.common.collect.MapDifference
MapDifference.ValueDifference<V>
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.Map<K,MapDifference.ValueDifference<V>>differences(package private) java.util.Map<K,V>onBoth(package private) java.util.Map<K,V>onlyOnLeft(package private) java.util.Map<K,V>onlyOnRight
-
Constructor Summary
Constructors Constructor Description MapDifferenceImpl(java.util.Map<K,V> onlyOnLeft, java.util.Map<K,V> onlyOnRight, java.util.Map<K,V> onBoth, java.util.Map<K,MapDifference.ValueDifference<V>> differences)
-
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,MapDifference.ValueDifference<V>>entriesDiffering()Returns an unmodifiable map describing keys that appear in both maps, but with different values.java.util.Map<K,V>entriesInCommon()Returns an unmodifiable map containing the entries that appear in both maps; that is, the intersection of the two maps.java.util.Map<K,V>entriesOnlyOnLeft()Returns an unmodifiable map containing the entries from the left map whose keys are not present in the right map.java.util.Map<K,V>entriesOnlyOnRight()Returns an unmodifiable map containing the entries from the right map whose keys are not present in the left map.booleanequals(java.lang.Object object)Compares the specified object with this instance for equality.inthashCode()Returns the hash code for this instance.java.lang.StringtoString()
-
-
-
Method Detail
-
areEqual
public boolean areEqual()
Description copied from interface:MapDifferenceReturnstrueif there are no differences between the two maps; that is, if the maps are equal.- Specified by:
areEqualin interfaceMapDifference<K,V>
-
entriesOnlyOnLeft
public java.util.Map<K,V> entriesOnlyOnLeft()
Description copied from interface:MapDifferenceReturns an unmodifiable map containing the entries from the left map whose keys are not present in the right map.- Specified by:
entriesOnlyOnLeftin interfaceMapDifference<K,V>
-
entriesOnlyOnRight
public java.util.Map<K,V> entriesOnlyOnRight()
Description copied from interface:MapDifferenceReturns an unmodifiable map containing the entries from the right map whose keys are not present in the left map.- Specified by:
entriesOnlyOnRightin interfaceMapDifference<K,V>
-
entriesInCommon
public java.util.Map<K,V> entriesInCommon()
Description copied from interface:MapDifferenceReturns an unmodifiable map containing the entries that appear in both maps; that is, the intersection of the two maps.- Specified by:
entriesInCommonin interfaceMapDifference<K,V>
-
entriesDiffering
public java.util.Map<K,MapDifference.ValueDifference<V>> entriesDiffering()
Description copied from interface:MapDifferenceReturns an unmodifiable map describing keys that appear in both maps, but with different values.- Specified by:
entriesDifferingin interfaceMapDifference<K,V>
-
equals
public boolean equals(java.lang.Object object)
Description copied from interface:MapDifferenceCompares the specified object with this instance for equality. Returnstrueif the given object is also aMapDifferenceand the values returned by theMapDifference.entriesOnlyOnLeft(),MapDifference.entriesOnlyOnRight(),MapDifference.entriesInCommon()andMapDifference.entriesDiffering()of the two instances are equal.- Specified by:
equalsin interfaceMapDifference<K,V>- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
Description copied from interface:MapDifferenceReturns the hash code for this instance. This is defined as the hash code ofArrays.asList(entriesOnlyOnLeft(), entriesOnlyOnRight(), entriesInCommon(), entriesDiffering())- Specified by:
hashCodein interfaceMapDifference<K,V>- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-