- Type Parameters:
E
- the element or element identifier type.
public interface Diff<E>
Represents the differences between two objects.
Elements that are only present in the left object are returned by the
getLeftSide()
method, while those only in the right object will be
in the array returned by getRightSide()
. Elements present on both
objects but in a different way will be returned by getDifferent()
.
If an object implementing this interface is returned by a call like
a.diff(b)
, then a
is the left object and
b
the right, the same for a call like diff(a,b)
.
-
Method Summary
Modifier and TypeMethodDescriptionE[]
Get an array with the elements that are present in both objects, but in a different way.E[]
Get an array with the elements that are only present in the left object.E[]
Get an array with the elements that are only present in the right object.boolean
Does this object contain any difference?
-
Method Details
-
hasDifferences
boolean hasDifferences()Does this object contain any difference?If this method returns
false
, theequals
method called on the same objects should returntrue
, but that is not required by this interface.- Returns:
true
if this object holds information on differences between two objects,false
if the tested objects are equal from the point of view of this diff object.
-
getLeftSide
E[] getLeftSide()Get an array with the elements that are only present in the left object.- Returns:
- an array with the elements (or element identifiers) that are only
present in the left object, or
null
otherwise.
-
getRightSide
E[] getRightSide()Get an array with the elements that are only present in the right object.- Returns:
- an array with the elements (or element identifiers) that are only
present in the right object, or
null
otherwise.
-
getDifferent
E[] getDifferent()Get an array with the elements that are present in both objects, but in a different way.- Returns:
- an array with the elements (or element identifiers) that are
present in both objects but in a different way, or
null
otherwise.
-