@@ -30,15 +30,15 @@ interface CharComparator {
3030 int compare (char c1 , char c2 );
3131 }
3232
33- private static final CharComparator CHARACTER_COMPARATOR = Platform .WINDOWS .isCurrent ()
34- ? FileUtils ::caseInsensitiveCharacterComparator
35- : FileUtils ::caseSensitiveCharacterComparator ;
33+ private static final CharComparator CHARACTER_COMPARATOR = Platform .LINUX .isCurrent ()
34+ ? FileUtils ::caseSensitiveCharacterComparator
35+ : FileUtils ::caseInsensitiveCharacterComparator ;
3636
37- private static final BiPredicate <String , String > STARTS_WITH = Platform .WINDOWS .isCurrent ()
38- ? FileUtils :: caseInsensitiveStartsWith
39- : String :: startsWith ;
37+ private static final BiPredicate <String , String > STARTS_WITH = Platform .LINUX .isCurrent ()
38+ ? String :: startsWith
39+ : FileUtils :: caseInsensitiveStartsWith ;
4040
41- private static final BiPredicate <String , String > EQUALS = Platform .WINDOWS .isCurrent () ? String ::equalsIgnoreCase : String ::equals ;
41+ private static final BiPredicate <String , String > EQUALS = Platform .LINUX .isCurrent () ? String ::equals : String ::equalsIgnoreCase ;
4242
4343 /**
4444 * For our lexicographic sort trick to work correctly, we must have path separators sort before
@@ -72,7 +72,7 @@ interface CharComparator {
7272 };
7373
7474 /**
75- * Case-insensitive character comparison. Inspired by the {@code WindowsPath#compareTo} implementation.
75+ * Case-insensitive character comparison. Taken from the JDK {@code WindowsPath#compareTo} implementation.
7676 */
7777 private static int caseInsensitiveCharacterComparator (char c1 , char c2 ) {
7878 if (c1 == c2 ) {
@@ -83,11 +83,11 @@ private static int caseInsensitiveCharacterComparator(char c1, char c2) {
8383 if (c1 == c2 ) {
8484 return 0 ;
8585 }
86- return c1 - c2 ;
86+ return Character . compare ( c1 , c2 ) ;
8787 }
8888
8989 private static int caseSensitiveCharacterComparator (char c1 , char c2 ) {
90- return c1 - c2 ;
90+ return Character . compare ( c1 , c2 ) ;
9191 }
9292
9393 private static boolean caseInsensitiveStartsWith (String s , String prefix ) {
0 commit comments