diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/webuser/WebListUsersCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/webuser/WebListUsersCommand.java index 8d0646d5e..1a2a98d60 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/webuser/WebListUsersCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/webuser/WebListUsersCommand.java @@ -5,8 +5,6 @@ import com.djrapitops.plugin.command.ISender; import com.djrapitops.plugin.command.SubCommand; import com.djrapitops.plugin.settings.ColorScheme; import com.djrapitops.plugin.task.AbsRunnable; -import java.util.Collections; -import java.util.List; import main.java.com.djrapitops.plan.Log; import main.java.com.djrapitops.plan.Permissions; import main.java.com.djrapitops.plan.Phrase; @@ -14,6 +12,8 @@ import main.java.com.djrapitops.plan.Plan; import main.java.com.djrapitops.plan.data.WebUser; import main.java.com.djrapitops.plan.utilities.comparators.WebUserComparator; +import java.util.List; + /** * Subcommand for checking WebUser list. * @@ -39,7 +39,7 @@ public class WebListUsersCommand extends SubCommand { String mCol = cs.getMainColor(); String sCol = cs.getSecondaryColor(); List users = plugin.getDB().getSecurityTable().getUsers(); - Collections.sort(users, new WebUserComparator()); + users.sort(new WebUserComparator()); sender.sendMessage(Phrase.CMD_FOOTER.parse() + mCol + " WebUsers (" + users.size() + ")"); for (WebUser user : users) { sender.sendMessage(" " + user.getPermLevel() + " : " + user.getName()); diff --git a/Plan/src/main/java/com/djrapitops/plan/data/cache/DataCacheHandler.java b/Plan/src/main/java/com/djrapitops/plan/data/cache/DataCacheHandler.java index a42d25300..9e19771f4 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/cache/DataCacheHandler.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/cache/DataCacheHandler.java @@ -272,7 +272,7 @@ public class DataCacheHandler extends SessionCache { toProcess.add(new LogoutInfo(uuid, time, p.isBanned(), p.getGamemode(), getSession(uuid))); } Log.debug("ToProcess size_AFTER: " + toProcess.size() + " DataCache size: " + dataCache.keySet().size()); - Collections.sort(toProcess, new HandlingInfoTimeComparator()); + toProcess.sort(new HandlingInfoTimeComparator()); processUnprocessedHandlingInfo(toProcess); Benchmark.stop("Cache: ProcessOnlineHandlingInfo"); List data = new ArrayList<>(); diff --git a/Plan/src/main/java/com/djrapitops/plan/data/cache/queue/Setup.java b/Plan/src/main/java/com/djrapitops/plan/data/cache/queue/Setup.java index 9f32477c2..cdc561088 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/cache/queue/Setup.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/cache/queue/Setup.java @@ -17,6 +17,7 @@ public abstract class Setup { * * @param consumers Consumers for the new threads. */ + @SafeVarargs public Setup(Consumer... consumers) { this.consumers = consumers; } diff --git a/Plan/src/main/java/com/djrapitops/plan/ui/html/graphs/ScatterGraphCreator.java b/Plan/src/main/java/com/djrapitops/plan/ui/html/graphs/ScatterGraphCreator.java index c1a5f0573..f9de8e967 100644 --- a/Plan/src/main/java/com/djrapitops/plan/ui/html/graphs/ScatterGraphCreator.java +++ b/Plan/src/main/java/com/djrapitops/plan/ui/html/graphs/ScatterGraphCreator.java @@ -51,7 +51,7 @@ public class ScatterGraphCreator { lastPoint = point; } points.addAll(toAdd); - Collections.sort(points, new PointComparator()); + points.sort(new PointComparator()); } int size = points.size(); diff --git a/Plan/src/main/java/com/djrapitops/plan/ui/html/graphs/TPSGraphCreator.java b/Plan/src/main/java/com/djrapitops/plan/ui/html/graphs/TPSGraphCreator.java index af576f6e0..ba9811b8b 100644 --- a/Plan/src/main/java/com/djrapitops/plan/ui/html/graphs/TPSGraphCreator.java +++ b/Plan/src/main/java/com/djrapitops/plan/ui/html/graphs/TPSGraphCreator.java @@ -22,7 +22,7 @@ public class TPSGraphCreator { long now = MiscUtils.getTime(); List filtered = filterTPS(tpsData, now - scale); Log.debug("TPSGraph, filtered: " + filtered.size()); - Collections.sort(filtered, new TPSComparator()); + filtered.sort(new TPSComparator()); List dates = filtered.stream().map(t -> t.getDate()).collect(Collectors.toList()); List tps = filtered.stream().map(t -> t.getTps()).collect(Collectors.toList()); List players = filtered.stream().map(t -> t.getPlayers()).collect(Collectors.toList()); diff --git a/Plan/src/main/java/com/djrapitops/plan/ui/html/tables/SessionTableCreator.java b/Plan/src/main/java/com/djrapitops/plan/ui/html/tables/SessionTableCreator.java index 704198dee..0fab01083 100644 --- a/Plan/src/main/java/com/djrapitops/plan/ui/html/tables/SessionTableCreator.java +++ b/Plan/src/main/java/com/djrapitops/plan/ui/html/tables/SessionTableCreator.java @@ -23,7 +23,7 @@ public class SessionTableCreator { if (sessionData.isEmpty()) { html += Html.TABLELINE_3.parse(Html.SESSIONDATA_NONE.parse(), "", ""); } else { - Collections.sort(sessionData, new SessionDataComparator()); + sessionData.sort(new SessionDataComparator()); Collections.reverse(sessionData); int i = 0; for (SessionData session : sessionData) { diff --git a/Plan/src/main/java/com/djrapitops/plan/ui/webserver/response/PlayersPageResponse.java b/Plan/src/main/java/com/djrapitops/plan/ui/webserver/response/PlayersPageResponse.java index a73574af5..631c49c4a 100644 --- a/Plan/src/main/java/com/djrapitops/plan/ui/webserver/response/PlayersPageResponse.java +++ b/Plan/src/main/java/com/djrapitops/plan/ui/webserver/response/PlayersPageResponse.java @@ -28,7 +28,7 @@ public class PlayersPageResponse extends Response { html.append("

Cached Players

") .append(size) .append(" players. Use browser's Search to find players by name. (Chrome Ctrl+F)

"); - Collections.sort(cached, new UserDataNameComparator()); + cached.sort(new UserDataNameComparator()); int i = 1; for (UserData userData : cached) { String name = userData.getName(); diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/Analysis.java b/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/Analysis.java index efac84d78..78c3a3940 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/Analysis.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/Analysis.java @@ -128,7 +128,7 @@ public class Analysis { */ public boolean analyzeData(List rawData, List tpsData, AnalysisCacheHandler analysisCache) { try { - Collections.sort(rawData, new UserDataLastPlayedComparator()); + rawData.sort(new UserDataLastPlayedComparator()); List uuids = rawData.stream().map(d -> d.getUuid()).collect(Collectors.toList()); Benchmark.start("Analysis: Create Empty dataset"); DataCacheHandler handler = plugin.getHandler(); diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/comparators/MapComparator.java b/Plan/src/main/java/com/djrapitops/plan/utilities/comparators/MapComparator.java index 9b555e15e..5b1d00618 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/comparators/MapComparator.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/comparators/MapComparator.java @@ -23,7 +23,7 @@ public class MapComparator { hashMap.keySet().stream().forEach((key) -> { sortedList.add(new String[]{"" + hashMap.get(key), key}); }); - Collections.sort(sortedList, (String[] strings, String[] otherStrings) -> Integer.parseInt(strings[0]) - (Integer.parseInt(otherStrings[0]))); + sortedList.sort((String[] strings, String[] otherStrings) -> Integer.parseInt(strings[0]) - (Integer.parseInt(otherStrings[0]))); return sortedList; } @@ -37,7 +37,7 @@ public class MapComparator { hashMap.keySet().stream().forEach((key) -> { sortedList.add(new String[]{"" + hashMap.get(key), key}); }); - Collections.sort(sortedList, (String[] strings, String[] otherStrings) -> Long.valueOf(strings[0]).compareTo(Long.valueOf(otherStrings[0]))); + sortedList.sort((String[] strings, String[] otherStrings) -> Long.valueOf(strings[0]).compareTo(Long.valueOf(otherStrings[0]))); return sortedList; } diff --git a/Plan/src/test/java/main/java/com/djrapitops/plan/utilities/comparators/HandlingInfoTimeComparatorTest.java b/Plan/src/test/java/main/java/com/djrapitops/plan/utilities/comparators/HandlingInfoTimeComparatorTest.java index 5b7170080..81112ff3c 100644 --- a/Plan/src/test/java/main/java/com/djrapitops/plan/utilities/comparators/HandlingInfoTimeComparatorTest.java +++ b/Plan/src/test/java/main/java/com/djrapitops/plan/utilities/comparators/HandlingInfoTimeComparatorTest.java @@ -41,7 +41,7 @@ public class HandlingInfoTimeComparatorTest { i.add(three); GamemodeInfo four = new GamemodeInfo(null, 700L, Gamemode.CREATIVE); i.add(four); - Collections.sort(i, new HandlingInfoTimeComparator()); + i.sort(new HandlingInfoTimeComparator()); assertEquals(three, i.get(0)); assertEquals(two, i.get(1)); assertEquals(one, i.get(2));