1 package ca.uhn.hl7v2.testpanel.util; 2 3 import java.io.File; 4 import java.util.Comparator; 5 6 /** 7 * Comparator which sorts by file name 8 */ 9 public class FileNameComparator implements Comparator<File> { 10 11 /** 12 * {@inheritDoc} 13 */ 14 public int compare(File theO1, File theO2) { 15 if (theO1 == null && theO2 == null) { 16 return 0; 17 } 18 19 if (theO1 == null) { 20 return -1; 21 } 22 23 if (theO2 == null) { 24 return 1; 25 } 26 27 return theO1.getName().compareTo(theO2.getName()); 28 } 29 30 }