File tree Expand file tree Collapse file tree 2 files changed +10
-20
lines changed
src/main/java/com/mergebase/log4j Expand file tree Collapse file tree 2 files changed +10
-20
lines changed Original file line number Diff line number Diff line change @@ -217,20 +217,17 @@ private static boolean isZipSentinel(int[] chunk) {
217
217
return chunk [0 ] == 0x50 && chunk [1 ] == 0x4B && chunk [2 ] == 3 && chunk [3 ] == 4 ;
218
218
}
219
219
220
- private static final Comparator <File > FILES_ORDER_BY_NAME = new Comparator <>() {
221
- @ Override
222
- public int compare (File f1 , File f2 ) {
223
- String s1 = f1 != null ? f1 .getName () : "" ;
224
- String s2 = f2 != null ? f2 .getName () : "" ;
225
- int c = s1 .compareToIgnoreCase (s2 );
226
- if (c == 0 ) {
227
- c = s1 .compareTo (s2 );
228
- if (c == 0 && f1 != null ) {
229
- c = f1 .compareTo (f2 );
230
- }
220
+ private static final Comparator <File > FILES_ORDER_BY_NAME = (f1 , f2 ) -> {
221
+ String s1 = f1 != null ? f1 .getName () : "" ;
222
+ String s2 = f2 != null ? f2 .getName () : "" ;
223
+ int c = s1 .compareToIgnoreCase (s2 );
224
+ if (c == 0 ) {
225
+ c = s1 .compareTo (s2 );
226
+ if (c == 0 && f1 != null ) {
227
+ c = f1 .compareTo (f2 );
231
228
}
232
- return c ;
233
229
}
230
+ return c ;
234
231
};
235
232
236
233
/**
Original file line number Diff line number Diff line change @@ -150,14 +150,7 @@ private static String[] subSplit(String s) {
150
150
}
151
151
152
152
public static Comparator <String > comparatorBySimilarity (final String anchor ) {
153
- return new Comparator <>() {
154
- @ Override
155
- public int compare (String o1 , String o2 ) {
156
- int i1 = similarity (anchor , o1 );
157
- int i2 = similarity (anchor , o2 );
158
- return Integer .compare (i1 , i2 );
159
- }
160
- };
153
+ return Comparator .comparingInt (s -> similarity (anchor , s ));
161
154
}
162
155
163
156
public static int similarity (String s1 , String s2 ) {
You can’t perform that action at this time.
0 commit comments