mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-11-24 03:05:52 +01:00
/f list sorting method performance boost
This commit is contained in:
parent
78a62bc25c
commit
23f55ee753
@ -48,9 +48,11 @@ public class CmdList extends FCommand
|
|||||||
Collections.sort(factionList, new Comparator<Faction>(){
|
Collections.sort(factionList, new Comparator<Faction>(){
|
||||||
@Override
|
@Override
|
||||||
public int compare(Faction f1, Faction f2) {
|
public int compare(Faction f1, Faction f2) {
|
||||||
if (f1.getFPlayers().size() < f2.getFPlayers().size())
|
int f1Size = f1.getFPlayers().size();
|
||||||
|
int f2Size = f2.getFPlayers().size();
|
||||||
|
if (f1Size < f2Size)
|
||||||
return 1;
|
return 1;
|
||||||
else if (f1.getFPlayers().size() > f2.getFPlayers().size())
|
else if (f1Size > f2Size)
|
||||||
return -1;
|
return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -60,9 +62,11 @@ public class CmdList extends FCommand
|
|||||||
Collections.sort(factionList, new Comparator<Faction>(){
|
Collections.sort(factionList, new Comparator<Faction>(){
|
||||||
@Override
|
@Override
|
||||||
public int compare(Faction f1, Faction f2) {
|
public int compare(Faction f1, Faction f2) {
|
||||||
if (f1.getFPlayersWhereOnline(true).size() < f2.getFPlayersWhereOnline(true).size())
|
int f1Size = f1.getFPlayersWhereOnline(true).size();
|
||||||
|
int f2Size = f2.getFPlayersWhereOnline(true).size();
|
||||||
|
if (f1Size < f2Size)
|
||||||
return 1;
|
return 1;
|
||||||
else if (f1.getFPlayersWhereOnline(true).size() > f2.getFPlayersWhereOnline(true).size())
|
else if (f1Size > f2Size)
|
||||||
return -1;
|
return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user