cleanup: use bulk operation instead of iteration

This commit is contained in:
P0nk
2021-04-08 17:44:35 +02:00
parent 3434c7334b
commit 202f2d8bc5
16 changed files with 42 additions and 101 deletions

View File

@@ -130,9 +130,7 @@ public final class Channel {
acceptor.getFilterChain().addLast("codec", new ProtocolCodecFilter(new MapleCodecFactory()));
acceptor.bind(new InetSocketAddress(port));
((SocketSessionConfig) acceptor.getSessionConfig()).setTcpNoDelay(true);
for (MapleExpeditionType exped : MapleExpeditionType.values()) {
expedType.add(exped);
}
expedType.addAll(Arrays.asList(MapleExpeditionType.values()));
if (Server.getInstance().isOnline()) { // postpone event loading to improve boot time... thanks Riizade, daronhudson for noticing slow startup times
eventSM = new EventScriptManager(this, getEvents());

View File

@@ -51,9 +51,7 @@ public final class UseOwlOfMinervaHandler extends AbstractMaplePacketHandler {
Comparator<Pair<Integer, Integer>> comparator = (p1, p2) -> p2.getRight().compareTo(p1.getRight());
PriorityQueue<Pair<Integer, Integer>> queue = new PriorityQueue<>(Math.max(1, owlSearched.size()), comparator);
for(Pair<Integer, Integer> p : owlSearched) {
queue.add(p);
}
queue.addAll(owlSearched);
owlLeaderboards = new LinkedList<>();
for(int i = 0; i < Math.min(owlSearched.size(), 10); i++) {