cleanup: use bulk operation instead of iteration
This commit is contained in:
@@ -21,17 +21,13 @@
|
||||
*/
|
||||
package life;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import life.MapleLifeFactory.BanishInfo;
|
||||
import life.MapleLifeFactory.loseItem;
|
||||
import life.MapleLifeFactory.selfDestruction;
|
||||
import tools.Pair;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Frz
|
||||
*/
|
||||
@@ -193,9 +189,7 @@ public class MapleMonsterStats {
|
||||
}
|
||||
|
||||
public void setSkills(List<Pair<Integer, Integer>> skills) {
|
||||
for (Pair<Integer, Integer> skill : skills) {
|
||||
this.skills.add(skill);
|
||||
}
|
||||
this.skills.addAll(skills);
|
||||
}
|
||||
|
||||
public List<Pair<Integer, Integer>> getSkills() {
|
||||
|
||||
@@ -578,9 +578,7 @@ public class MapleCashCosmeticsChecker {
|
||||
List<Pair<Pair<Integer, String>, List<Integer>>> list = new ArrayList<>(map.size());
|
||||
for(Entry<Pair<Integer, String>, Set<Integer>> e : map.entrySet()) {
|
||||
List<Integer> il = new ArrayList<>(2);
|
||||
for(Integer i : e.getValue()) {
|
||||
il.add(i);
|
||||
}
|
||||
il.addAll(e.getValue());
|
||||
|
||||
Collections.sort(il, (o1, o2) -> o1 - o2);
|
||||
|
||||
|
||||
@@ -21,17 +21,13 @@
|
||||
*/
|
||||
package life;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import life.MapleLifeFactory.BanishInfo;
|
||||
import life.MapleLifeFactory.loseItem;
|
||||
import life.MapleLifeFactory.selfDestruction;
|
||||
import tools.Pair;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Frz
|
||||
*/
|
||||
@@ -193,9 +189,7 @@ public class MapleMonsterStats {
|
||||
}
|
||||
|
||||
public void setSkills(List<Pair<Integer, Integer>> skills) {
|
||||
for (Pair<Integer, Integer> skill : skills) {
|
||||
this.skills.add(skill);
|
||||
}
|
||||
this.skills.addAll(skills);
|
||||
}
|
||||
|
||||
public List<Pair<Integer, Integer>> getSkills() {
|
||||
|
||||
@@ -411,9 +411,7 @@ public class MapleQuestItemFetcher {
|
||||
|
||||
private static List<Entry<Integer, Integer>> getSortedMapEntries0(Map<Integer, Integer> map) {
|
||||
List<Entry<Integer, Integer>> list = new ArrayList<>(map.size());
|
||||
for(Entry<Integer, Integer> e : map.entrySet()) {
|
||||
list.add(e);
|
||||
}
|
||||
list.addAll(map.entrySet());
|
||||
|
||||
Collections.sort(list, (o1, o2) -> o1.getKey() - o2.getKey());
|
||||
|
||||
@@ -422,9 +420,7 @@ public class MapleQuestItemFetcher {
|
||||
|
||||
private static List<Entry<Integer, int[]>> getSortedMapEntries1(Map<Integer, int[]> map) {
|
||||
List<Entry<Integer, int[]>> list = new ArrayList<>(map.size());
|
||||
for(Entry<Integer, int[]> e : map.entrySet()) {
|
||||
list.add(e);
|
||||
}
|
||||
list.addAll(map.entrySet());
|
||||
|
||||
Collections.sort(list, (o1, o2) -> o1.getKey() - o2.getKey());
|
||||
|
||||
@@ -435,9 +431,7 @@ public class MapleQuestItemFetcher {
|
||||
List<Pair<Integer, List<Integer>>> list = new ArrayList<>(map.size());
|
||||
for(Entry<Integer, Set<Integer>> e : map.entrySet()) {
|
||||
List<Integer> il = new ArrayList<>(2);
|
||||
for(Integer i : e.getValue()) {
|
||||
il.add(i);
|
||||
}
|
||||
il.addAll(e.getValue());
|
||||
|
||||
Collections.sort(il, (o1, o2) -> o1 - o2);
|
||||
|
||||
|
||||
@@ -21,17 +21,13 @@
|
||||
*/
|
||||
package life;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import life.MapleLifeFactory.BanishInfo;
|
||||
import life.MapleLifeFactory.loseItem;
|
||||
import life.MapleLifeFactory.selfDestruction;
|
||||
import tools.Pair;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Frz
|
||||
*/
|
||||
@@ -193,9 +189,7 @@ public class MapleMonsterStats {
|
||||
}
|
||||
|
||||
public void setSkills(List<Pair<Integer, Integer>> skills) {
|
||||
for (Pair<Integer, Integer> skill : skills) {
|
||||
this.skills.add(skill);
|
||||
}
|
||||
this.skills.addAll(skills);
|
||||
}
|
||||
|
||||
public List<Pair<Integer, Integer>> getSkills() {
|
||||
|
||||
Reference in New Issue
Block a user