1 22 23 package caramel.util; 24 25 import java.io.*; 26 import java.util.*; 27 28 public class FileComparator implements Comparator 29 { 30 33 public int compare( Object obj1, Object obj2 ) 34 { 35 File left = ( File ) obj1; 36 File right = ( File ) obj2; 37 38 int result = left.getName().compareToIgnoreCase( right.getName() ); 39 if( result == 0 ) 40 result = left.getAbsolutePath().compareToIgnoreCase( right.getAbsolutePath() ); 41 42 return result; 43 } 44 } 45 | Popular Tags |