com.limegroup.gnutella.util
Class FileComparator

java.lang.Object
  extended bycom.limegroup.gnutella.util.FileComparator
All Implemented Interfaces:
java.util.Comparator, java.io.Serializable

public class FileComparator
extends java.lang.Object
implements java.util.Comparator, java.io.Serializable

Compares to File's lexically by file name). Useful for storing Java 1.1.8 Files in Java 1.2+ sorted collections classes. This is needed because Files in 1.1.8 do not implement the Comparable interface, unlike Strings in 1.2+.

See Also:
Serialized Form

Constructor Summary
FileComparator()
           
 
Method Summary
 int compare(java.lang.Object a, java.lang.Object b)
          Returns (((File)a).getAbsolutePath()).compareTo( ((File)b).getAbsolutePath()) Typically you'll want to make sure a and b are canonical files, but that isn't strictly necessary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

FileComparator

public FileComparator()
Method Detail

compare

public int compare(java.lang.Object a,
                   java.lang.Object b)
Returns (((File)a).getAbsolutePath()).compareTo( ((File)b).getAbsolutePath()) Typically you'll want to make sure a and b are canonical files, but that isn't strictly necessary.

Specified by:
compare in interface java.util.Comparator