Top Description Inners Methods
com.google.common.collect

public Interface MapDifference<K extends @Nullable Object, V extends @Nullable Object>

Known Direct Subinterfaces
com.google.common.collect.SortedMapDifference
Known Direct Implementers
com.google.common.collect.Maps.MapDifferenceImpl
Annotations
@DoNotMock:Use Maps.difference
@GwtCompatible
@ElementTypesAreNonnullByDefault
Imports
com.google.common.annotations.GwtCompatible, com.google.errorprone.annotations.DoNotMock, java.util.Map, javax.annotation.CheckForNull, org.checkerframework.checker.nullness.qual.Nullable

An object representing the differences between two maps.
Author
Kevin Bourrillion
Since
2.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
MapDifference.ValueDifference<V extends @Nullable Object>

A difference between the mappings from two maps with the same key.

Method Summary

Modifier and TypeMethod and Description
public boolean
areEqual()

Returns true if there are no differences between the two maps; that is, if the maps are equal.

public Map<K, MapDifference.ValueDifference<V>>
entriesDiffering()

Returns an unmodifiable map describing keys that appear in both maps, but with different values.

public Map<K, V>
entriesInCommon()

Returns an unmodifiable map containing the entries that appear in both maps; that is, the intersection of the two maps.

public Map<K, V>
entriesOnlyOnLeft()

Returns an unmodifiable map containing the entries from the left map whose keys are not present in the right map.

public Map<K, V>
entriesOnlyOnRight()

Returns an unmodifiable map containing the entries from the right map whose keys are not present in the left map.

public boolean
equals(Object object)

Compares the specified object with this instance for equality.

public int
hashCode()

Returns the hash code for this instance.

Method Detail

areEqualback to summary
public boolean areEqual()

Returns true if there are no differences between the two maps; that is, if the maps are equal.

entriesDifferingback to summary
public Map<K, MapDifference.ValueDifference<V>> entriesDiffering()

Returns an unmodifiable map describing keys that appear in both maps, but with different values.

entriesInCommonback to summary
public Map<K, V> entriesInCommon()

Returns an unmodifiable map containing the entries that appear in both maps; that is, the intersection of the two maps.

entriesOnlyOnLeftback to summary
public Map<K, V> entriesOnlyOnLeft()

Returns an unmodifiable map containing the entries from the left map whose keys are not present in the right map.

entriesOnlyOnRightback to summary
public Map<K, V> entriesOnlyOnRight()

Returns an unmodifiable map containing the entries from the right map whose keys are not present in the left map.

equalsback to summary
public boolean equals(Object object)

Compares the specified object with this instance for equality. Returns true if the given object is also a MapDifference and the values returned by the entriesOnlyOnLeft(), entriesOnlyOnRight(), entriesInCommon() and entriesDiffering() of the two instances are equal.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Returns the hash code for this instance. This is defined as the hash code of

Arrays.asList(entriesOnlyOnLeft(), entriesOnlyOnRight(),
    entriesInCommon(), entriesDiffering())
Annotations
@Override
com.google.common.collect back to summary

public Interface MapDifference.ValueDifference<V extends @Nullable Object>

Known Direct Implementers
com.google.common.collect.Maps.ValueDifferenceImpl
Annotations
@DoNotMock:Use Maps.difference

A difference between the mappings from two maps with the same key. The leftValue and rightValue are not equal, and one but not both of them may be null.
Since
2.0

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object other)

Two instances are considered equal if their leftValue() values are equal and their rightValue() values are also equal.

public int
hashCode()

The hash code equals the value Arrays.asList(leftValue(), rightValue()).hashCode().

public V
leftValue()

Returns the value from the left map (possibly null).

public V
rightValue()

Returns the value from the right map (possibly null).

Method Detail

equalsback to summary
public boolean equals(Object other)

Two instances are considered equal if their leftValue() values are equal and their rightValue() values are also equal.

Annotations
@Override
hashCodeback to summary
public int hashCode()

The hash code equals the value Arrays.asList(leftValue(), rightValue()).hashCode().

Annotations
@Override
leftValueback to summary
public V leftValue()

Returns the value from the left map (possibly null).

Annotations
@ParametricNullness
rightValueback to summary
public V rightValue()

Returns the value from the right map (possibly null).

Annotations
@ParametricNullness