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 boolean
areEqual()
Returnstrue
if 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.boolean
equals(java.lang.Object object)
Compares the specified object with this instance for equality.int
hashCode()
Returns the hash code for this instance.java.lang.String
toString()
-
-
-
Method Detail
-
areEqual
public boolean areEqual()
Description copied from interface:MapDifference
Returnstrue
if there are no differences between the two maps; that is, if the maps are equal.- Specified by:
areEqual
in interfaceMapDifference<K,V>
-
entriesOnlyOnLeft
public java.util.Map<K,V> entriesOnlyOnLeft()
Description copied from interface:MapDifference
Returns an unmodifiable map containing the entries from the left map whose keys are not present in the right map.- Specified by:
entriesOnlyOnLeft
in interfaceMapDifference<K,V>
-
entriesOnlyOnRight
public java.util.Map<K,V> entriesOnlyOnRight()
Description copied from interface:MapDifference
Returns an unmodifiable map containing the entries from the right map whose keys are not present in the left map.- Specified by:
entriesOnlyOnRight
in interfaceMapDifference<K,V>
-
entriesInCommon
public java.util.Map<K,V> entriesInCommon()
Description copied from interface:MapDifference
Returns an unmodifiable map containing the entries that appear in both maps; that is, the intersection of the two maps.- Specified by:
entriesInCommon
in interfaceMapDifference<K,V>
-
entriesDiffering
public java.util.Map<K,MapDifference.ValueDifference<V>> entriesDiffering()
Description copied from interface:MapDifference
Returns an unmodifiable map describing keys that appear in both maps, but with different values.- Specified by:
entriesDiffering
in interfaceMapDifference<K,V>
-
equals
public boolean equals(@CheckForNull java.lang.Object object)
Description copied from interface:MapDifference
Compares the specified object with this instance for equality. Returnstrue
if the given object is also aMapDifference
and the values returned by theMapDifference.entriesOnlyOnLeft()
,MapDifference.entriesOnlyOnRight()
,MapDifference.entriesInCommon()
andMapDifference.entriesDiffering()
of the two instances are equal.- Specified by:
equals
in interfaceMapDifference<K,V>
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
Description copied from interface:MapDifference
Returns the hash code for this instance. This is defined as the hash code ofArrays.asList(entriesOnlyOnLeft(), entriesOnlyOnRight(), entriesInCommon(), entriesDiffering())
- Specified by:
hashCode
in interfaceMapDifference<K,V>
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-