Refactor compareLong method using Long.compare, corrected the local variable name (#1136)

master
Harikrishna 2023-11-24 10:07:04 +05:30 committed by GitHub
parent 67644de3d9
commit 622ed5a17f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 10 deletions

View File

@ -6,12 +6,6 @@ package us.codecraft.webmagic.utils;
public abstract class NumberUtils {
public static int compareLong(long o1, long o2) {
if (o1 < o2) {
return -1;
} else if (o1 == o2) {
return 0;
} else {
return 1;
}
return Long.compare(o1, o2);
}
}

View File

@ -21,10 +21,10 @@ public class WMCollections {
}
public static <T> List<T> newArrayList(T... t){
List<T> set = new ArrayList<T>(t.length);
List<T> list = new ArrayList<T>(t.length);
for (T t1 : t) {
set.add(t1);
list.add(t1);
}
return set;
return list;
}
}