|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuk.ac.ed.inf.utils.diff.Diff
public class Diff
Compares two collections, 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") collection 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" collections; otherwise, for speed, hash
codes from the objects will be used instead for comparison.
The file FileDiff.java shows an example usage of this class, in an application similar to the Unix "diff" program.
| Constructor Summary | |
|---|---|
Diff(java.util.Collection a,
java.util.Collection b)
Constructs the Diff object for the two collections, using the default comparison mechanism between the objects, such as equals and
compareTo. |
|
Diff(java.util.Collection a,
java.util.Collection b,
java.util.Comparator comp)
Constructs the Diff object for the two collections, using the given comparator. |
|
Diff(java.lang.Object[] a,
java.lang.Object[] b)
Constructs the Diff object for the two arrays, using the default comparison mechanism between the objects, such as equals and
compareTo. |
|
Diff(java.lang.Object[] a,
java.lang.Object[] b,
java.util.Comparator comp)
Constructs the Diff object for the two arrays, using the given comparator. |
|
| Method Summary | |
|---|---|
java.util.List |
diff()
Runs diff and returns the results. |
java.lang.Integer[] |
getLongestCommonSubsequences()
Returns an array of the longest common subsequences. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Diff(java.util.Collection a,
java.util.Collection b)
equals and
compareTo.
public Diff(java.util.Collection a,
java.util.Collection b,
java.util.Comparator comp)
public Diff(java.lang.Object[] a,
java.lang.Object[] b)
equals and
compareTo.
public Diff(java.lang.Object[] a,
java.lang.Object[] b,
java.util.Comparator comp)
| Method Detail |
|---|
public java.util.List diff()
public java.lang.Integer[] getLongestCommonSubsequences()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||