mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-06 10:49:44 +01:00
Adds annotation @SafeVarargs in the Setup class
Replace Collections.sort() with #List.sort()
This commit is contained in:
parent
6966ed2206
commit
1decc82957
@ -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<WebUser> 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());
|
||||
|
@ -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<UserData> data = new ArrayList<>();
|
||||
|
@ -17,6 +17,7 @@ public abstract class Setup<T> {
|
||||
*
|
||||
* @param consumers Consumers for the new threads.
|
||||
*/
|
||||
@SafeVarargs
|
||||
public Setup(Consumer<T>... consumers) {
|
||||
this.consumers = consumers;
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -22,7 +22,7 @@ public class TPSGraphCreator {
|
||||
long now = MiscUtils.getTime();
|
||||
List<TPS> filtered = filterTPS(tpsData, now - scale);
|
||||
Log.debug("TPSGraph, filtered: " + filtered.size());
|
||||
Collections.sort(filtered, new TPSComparator());
|
||||
filtered.sort(new TPSComparator());
|
||||
List<Long> dates = filtered.stream().map(t -> t.getDate()).collect(Collectors.toList());
|
||||
List<Double> tps = filtered.stream().map(t -> t.getTps()).collect(Collectors.toList());
|
||||
List<Integer> players = filtered.stream().map(t -> t.getPlayers()).collect(Collectors.toList());
|
||||
|
@ -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) {
|
||||
|
@ -28,7 +28,7 @@ public class PlayersPageResponse extends Response {
|
||||
html.append("<h1>Cached Players</h1><p>")
|
||||
.append(size)
|
||||
.append(" players. Use browser's Search to find players by name. (Chrome Ctrl+F)</p><table><tr>");
|
||||
Collections.sort(cached, new UserDataNameComparator());
|
||||
cached.sort(new UserDataNameComparator());
|
||||
int i = 1;
|
||||
for (UserData userData : cached) {
|
||||
String name = userData.getName();
|
||||
|
@ -128,7 +128,7 @@ public class Analysis {
|
||||
*/
|
||||
public boolean analyzeData(List<UserData> rawData, List<TPS> tpsData, AnalysisCacheHandler analysisCache) {
|
||||
try {
|
||||
Collections.sort(rawData, new UserDataLastPlayedComparator());
|
||||
rawData.sort(new UserDataLastPlayedComparator());
|
||||
List<UUID> uuids = rawData.stream().map(d -> d.getUuid()).collect(Collectors.toList());
|
||||
Benchmark.start("Analysis: Create Empty dataset");
|
||||
DataCacheHandler handler = plugin.getHandler();
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user