Class Diff<Type>
java.lang.Object
org.jjazz.utilities.api.Diff<Type>
- Type Parameters:
Type-
Compares two lists, returning a list of the additions, changes, and deletions between them.
A Comparator may be passed as an argument to the constructor, and will thus be used. If not provided, the initial value in the a
("from") list will be looked at to see if it supports the Comparable interface. If so, its equals and compareTo
methods will be invoked on the instances in the "from" and "to" lists; otherwise, for speed, hash codes from the objects will be used instead for comparison.
JJazzLab changes: updated so that each CHANGED difference has the same number of objects in/out.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> List<Diff.Difference> Compute differences for the two lists, using the default comparison mechanism between the objects, such asequalsandcompareTo.static <T> List<Diff.Difference> diff(List<T> a, List<T> b, Comparator<T> comp) Compute differences for the two lists, using the specified comparison mechanism.static <T> List<Diff.Difference> diff(T[] a, T[] b) Compute differences for the two arrays, using the default comparison mechanism between the objects, such asequalsandcompareTo.static <T> List<Diff.Difference> diff(T[] a, T[] b, Comparator<T> comp) Compute differences for the two arrays, using the specified comparison mechanism.
-
Method Details
-
diff
Compute differences for the two arrays, using the specified comparison mechanism.- Type Parameters:
T-- Parameters:
a-b-comp-- Returns:
-
diff
Compute differences for the two arrays, using the default comparison mechanism between the objects, such asequalsandcompareTo.- Type Parameters:
T-- Parameters:
a-b-- Returns:
-
diff
Compute differences for the two lists, using the specified comparison mechanism.- Type Parameters:
T-- Parameters:
a-b-comp-- Returns:
-
diff
Compute differences for the two lists, using the default comparison mechanism between the objects, such asequalsandcompareTo.- Type Parameters:
T-- Parameters:
a-b-- Returns:
-