mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-23 09:37:54 +01:00
Replaces .compareTo with Long.compare when possible
This commit is contained in:
parent
8a90f60142
commit
5cf5eaf1ad
@ -5,9 +5,10 @@
|
||||
*/
|
||||
package main.java.com.djrapitops.plan.utilities.comparators;
|
||||
|
||||
import java.util.Comparator;
|
||||
import main.java.com.djrapitops.plan.data.handling.info.HandlingInfo;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rsl1122
|
||||
@ -16,7 +17,7 @@ public class HandlingInfoTimeComparator implements Comparator<HandlingInfo> {
|
||||
|
||||
@Override
|
||||
public int compare(HandlingInfo o1, HandlingInfo o2) {
|
||||
return ((Long) o1.getTime()).compareTo((Long) o2.getTime());
|
||||
return Long.compare(o1.getTime(), o2.getTime());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,9 @@
|
||||
package main.java.com.djrapitops.plan.utilities.comparators;
|
||||
|
||||
import java.util.Comparator;
|
||||
import main.java.com.djrapitops.plan.data.SessionData;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rsl1122
|
||||
@ -12,12 +13,6 @@ public class SessionDataComparator implements Comparator<SessionData> {
|
||||
// This method should only be used if FactionsHook.isEnabled() returns true.
|
||||
@Override
|
||||
public int compare(SessionData s1, SessionData s2) {
|
||||
if (s1.getSessionStart() == s2.getSessionStart()) {
|
||||
return 0;
|
||||
}
|
||||
if (s1.getSessionStart() > s2.getSessionStart()) {
|
||||
return 1;
|
||||
}
|
||||
return -1;
|
||||
return Long.compare(s1.getSessionStart(), s2.getSessionStart());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user