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.
LGPL, Jeff Pace | |