Merge branch 'master' into 'master'

Some codes needed to revert

See merge request core-developers/forge!2104
This commit is contained in:
swordshine
2019-09-09 06:25:53 +00:00
28 changed files with 46 additions and 36 deletions

View File

@@ -27,6 +27,7 @@ import forge.util.ItemPoolSorter;
import forge.util.MyRandom; import forge.util.MyRandom;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
@@ -197,7 +198,7 @@ public class CardPool extends ItemPool<PaperCard> {
public String toCardList(String separator) { public String toCardList(String separator) {
List<Entry<PaperCard, Integer>> main2sort = Lists.newArrayList(this); List<Entry<PaperCard, Integer>> main2sort = Lists.newArrayList(this);
main2sort.sort(ItemPoolSorter.BY_NAME_THEN_SET); Collections.sort(main2sort, ItemPoolSorter.BY_NAME_THEN_SET);
final CardDb commonDb = StaticData.instance().getCommonCards(); final CardDb commonDb = StaticData.instance().getCommonCards();
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();

View File

@@ -123,7 +123,7 @@ public class Deck extends DeckBase implements Iterable<Entry<DeckSection, CardPo
result.add(c.getKey()); result.add(c.getKey());
} }
if (result.size() > 1) { //sort by type so signature spell comes after oathbreaker if (result.size() > 1) { //sort by type so signature spell comes after oathbreaker
result.sort(new Comparator<PaperCard>() { Collections.sort(result, new Comparator<PaperCard>() {
@Override @Override
public int compare(final PaperCard c1, final PaperCard c2) { public int compare(final PaperCard c1, final PaperCard c2) {
return Boolean.compare(c1.getRules().canBeSignatureSpell(), c2.getRules().canBeSignatureSpell()); return Boolean.compare(c1.getRules().canBeSignatureSpell(), c2.getRules().canBeSignatureSpell());

View File

@@ -79,7 +79,7 @@ public class DeckGroup extends DeckBase {
if (aiDecks.size() < 2) { if (aiDecks.size() < 2) {
return; return;
} }
aiDecks.sort(comparator); Collections.sort(aiDecks, comparator);
} }
@Override @Override

View File

@@ -506,7 +506,7 @@ public class FCollection<T> implements List<T>, /*Set<T>,*/ FCollectionView<T>,
* {@inheritDoc} * {@inheritDoc}
*/ */
public void sort(final Comparator<? super T> comparator) { public void sort(final Comparator<? super T> comparator) {
list.sort(comparator); Collections.sort(list, comparator);
} }
/** /**

View File

@@ -132,7 +132,7 @@ public final class MapToAmountUtil {
for (final Entry<T, Integer> entry : map.entrySet()) { for (final Entry<T, Integer> entry : map.entrySet()) {
entries.add(Pair.of(entry.getKey(), entry.getValue())); entries.add(Pair.of(entry.getKey(), entry.getValue()));
} }
entries.sort(new Comparator<Entry<T, Integer>>() { Collections.sort(entries, new Comparator<Entry<T, Integer>>() {
@Override @Override
public int compare(final Entry<T, Integer> o1, final Entry<T, Integer> o2) { public int compare(final Entry<T, Integer> o1, final Entry<T, Integer> o2) {
return o1.getValue().compareTo(o2.getValue()); return o1.getValue().compareTo(o2.getValue());

View File

@@ -35,6 +35,7 @@ import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter; import java.awt.event.MouseMotionAdapter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.LinkedList; import java.util.LinkedList;
@@ -164,9 +165,8 @@ public final class ItemListView<T extends InventoryItem> extends ItemView<T> {
columns.add(colOverrides.get(colConfig.getDef())); columns.add(colOverrides.get(colConfig.getDef()));
} }
} }
columns.sort(new Comparator<ItemTableColumn>() { Collections.sort(columns, new Comparator<ItemTableColumn>() {
@Override @Override public int compare(final ItemTableColumn arg0, final ItemTableColumn arg1) {
public int compare(final ItemTableColumn arg0, final ItemTableColumn arg1) {
return Integer.compare(arg0.getIndex(), arg1.getIndex()); return Integer.compare(arg0.getIndex(), arg1.getIndex());
} }
}); });

View File

@@ -4,6 +4,7 @@ import java.awt.Color;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
@@ -46,7 +47,7 @@ public class ContestGauntletLister extends JPanel {
final List<RowPanel> tempRows = new ArrayList<>(); final List<RowPanel> tempRows = new ArrayList<>();
final List<GauntletData> sorted = new ArrayList<>(); final List<GauntletData> sorted = new ArrayList<>();
sorted.addAll(gd0); sorted.addAll(gd0);
sorted.sort(new Comparator<GauntletData>() { Collections.sort(sorted, new Comparator<GauntletData>() {
@Override @Override
public int compare(final GauntletData x, final GauntletData y) { public int compare(final GauntletData x, final GauntletData y) {
return x.getName().compareTo(y.getName()); return x.getName().compareTo(y.getName());

View File

@@ -4,6 +4,7 @@ import java.awt.Color;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
@@ -65,7 +66,7 @@ public class QuickGauntletLister extends JPanel {
final List<RowPanel> tempRows = new ArrayList<>(); final List<RowPanel> tempRows = new ArrayList<>();
final List<GauntletData> sorted = new ArrayList<>(); final List<GauntletData> sorted = new ArrayList<>();
sorted.addAll(gauntlets); sorted.addAll(gauntlets);
sorted.sort(new Comparator<GauntletData>() { Collections.sort(sorted, new Comparator<GauntletData>() {
@Override @Override
public int compare(final GauntletData x, final GauntletData y) { public int compare(final GauntletData x, final GauntletData y) {
return x.getName().toLowerCase().compareTo(y.getName().toLowerCase()); return x.getName().toLowerCase().compareTo(y.getName().toLowerCase());

View File

@@ -67,7 +67,7 @@ public class QuestFileLister extends JPanel {
List<RowPanel> tempRows = new ArrayList<>(); List<RowPanel> tempRows = new ArrayList<>();
List<QuestData> sorted = new ArrayList<>(); List<QuestData> sorted = new ArrayList<>();
sorted.addAll(qd0); sorted.addAll(qd0);
sorted.sort(new Comparator<QuestData>() { Collections.sort(sorted, new Comparator<QuestData>() {
@Override @Override
public int compare(final QuestData x, final QuestData y) { public int compare(final QuestData x, final QuestData y) {
return x.getName().toLowerCase().compareTo(y.getName().toLowerCase()); return x.getName().toLowerCase().compareTo(y.getName().toLowerCase());

View File

@@ -19,6 +19,7 @@ package forge.view.arcane;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
@@ -126,7 +127,7 @@ public class FloatingZone extends FloatingCardArea {
if ( zoneCards != null ) { if ( zoneCards != null ) {
cardList = new FCollection<>(zoneCards); cardList = new FCollection<>(zoneCards);
if ( sortedByName ) { if ( sortedByName ) {
cardList.sort(comp); Collections.sort(cardList, comp);
} }
return cardList; return cardList;
} else { } else {

View File

@@ -229,7 +229,7 @@ public abstract class ItemManager<T extends InventoryItem> extends FContainer im
cols.add(colOverrides.get(colConfig.getDef())); cols.add(colOverrides.get(colConfig.getDef()));
} }
} }
cols.sort(new Comparator<ItemColumn>() { Collections.sort(cols, new Comparator<ItemColumn>() {
@Override @Override
public int compare(ItemColumn arg0, ItemColumn arg1) { public int compare(ItemColumn arg0, ItemColumn arg1) {
return Integer.compare(arg0.getConfig().getIndex(), arg1.getConfig().getIndex()); return Integer.compare(arg0.getConfig().getIndex(), arg1.getConfig().getIndex());

View File

@@ -3,6 +3,7 @@ package forge.screens.gauntlet;
import java.io.File; import java.io.File;
import java.text.NumberFormat; import java.text.NumberFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import com.badlogic.gdx.utils.Align; import com.badlogic.gdx.utils.Align;
@@ -296,7 +297,7 @@ public class LoadGauntletScreen extends LaunchScreen {
public void refresh() { public void refresh() {
List<GauntletData> sorted = new ArrayList<>(); List<GauntletData> sorted = new ArrayList<>();
sorted.addAll(gauntlets); sorted.addAll(gauntlets);
sorted.sort(new Comparator<GauntletData>() { Collections.sort(sorted, new Comparator<GauntletData>() {
@Override @Override
public int compare(final GauntletData x, final GauntletData y) { public int compare(final GauntletData x, final GauntletData y) {
return x.getName().toLowerCase().compareTo(y.getName().toLowerCase()); return x.getName().toLowerCase().compareTo(y.getName().toLowerCase());

View File

@@ -2,6 +2,7 @@ package forge.screens.planarconquest;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@@ -335,7 +336,7 @@ public class LoadConquestScreen extends LaunchScreen {
public void setConquests(List<ConquestData> qd0) { public void setConquests(List<ConquestData> qd0) {
List<ConquestData> sorted = new ArrayList<>(); List<ConquestData> sorted = new ArrayList<>();
sorted.addAll(qd0); sorted.addAll(qd0);
sorted.sort(new Comparator<ConquestData>() { Collections.sort(sorted, new Comparator<ConquestData>() {
@Override @Override
public int compare(final ConquestData x, final ConquestData y) { public int compare(final ConquestData x, final ConquestData y) {
return x.getName().toLowerCase().compareTo(y.getName().toLowerCase()); return x.getName().toLowerCase().compareTo(y.getName().toLowerCase());

View File

@@ -4,6 +4,7 @@ import java.io.File;
import java.io.FilenameFilter; import java.io.FilenameFilter;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@@ -336,7 +337,7 @@ public class LoadQuestScreen extends LaunchScreen {
public void setQuests(List<QuestData> qd0) { public void setQuests(List<QuestData> qd0) {
List<QuestData> sorted = new ArrayList<>(); List<QuestData> sorted = new ArrayList<>();
sorted.addAll(qd0); sorted.addAll(qd0);
sorted.sort(new Comparator<QuestData>() { Collections.sort(sorted, new Comparator<QuestData>() {
@Override @Override
public int compare(final QuestData x, final QuestData y) { public int compare(final QuestData x, final QuestData y) {
return x.getName().toLowerCase().compareTo(y.getName().toLowerCase()); return x.getName().toLowerCase().compareTo(y.getName().toLowerCase());

View File

@@ -334,7 +334,7 @@ public class GuiChoose {
// If comparer is NULL, T has to be comparable. Otherwise you'll get an exception from inside the Arrays.sort() routine // If comparer is NULL, T has to be comparable. Otherwise you'll get an exception from inside the Arrays.sort() routine
public static <T> void sortedGetChoices(final String message, final int min, final int max, final List<T> choices, Comparator<T> comparer, final Callback<List<T>> callback) { public static <T> void sortedGetChoices(final String message, final int min, final int max, final List<T> choices, Comparator<T> comparer, final Callback<List<T>> callback) {
// You may create a copy of source list if callers expect the collection to be unchanged // You may create a copy of source list if callers expect the collection to be unchanged
choices.sort(comparer); Collections.sort(choices, comparer);
getChoices(message, min, max, choices, callback); getChoices(message, min, max, choices, callback);
} }
} }

View File

@@ -209,7 +209,7 @@ public class AdvancedSearch {
List<PaperCard> cards = FModel.getMagicDb().getCommonCards().getAllCards(input.getName()); List<PaperCard> cards = FModel.getMagicDb().getCommonCards().getAllCards(input.getName());
if (cards.size() <= 1) { return true; } if (cards.size() <= 1) { return true; }
cards.sort(FModel.getMagicDb().getEditions().CARD_EDITION_COMPARATOR); Collections.sort(cards, FModel.getMagicDb().getEditions().CARD_EDITION_COMPARATOR);
return cards.get(0) == input; return cards.get(0) == input;
} }
}), }),

View File

@@ -18,6 +18,7 @@
package forge.itemmanager; package forge.itemmanager;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
@@ -124,7 +125,7 @@ public final class ItemManagerModel<T extends InventoryItem> {
public void refreshSort() { public void refreshSort() {
if (getOrderedList().isEmpty()) { return; } if (getOrderedList().isEmpty()) { return; }
getOrderedList().sort(new MyComparator()); Collections.sort(getOrderedList(), new MyComparator());
} }
//Manages sorting orders for multiple depths of sorting //Manages sorting orders for multiple depths of sorting

View File

@@ -12,6 +12,7 @@ import forge.util.ComparableOp;
import forge.util.Localizer; import forge.util.Localizer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
@@ -146,7 +147,7 @@ public final class SItemManagerUtil {
for (final Entry<InventoryItem, Integer> itemEntry : items) { for (final Entry<InventoryItem, Integer> itemEntry : items) {
sorted.add(itemEntry); sorted.add(itemEntry);
} }
sorted.sort(new Comparator<Entry<InventoryItem, Integer>>() { Collections.sort(sorted, new Comparator<Entry<InventoryItem, Integer>>() {
@Override @Override
public int compare(final Entry<InventoryItem, Integer> x, final Entry<InventoryItem, Integer> y) { public int compare(final Entry<InventoryItem, Integer> x, final Entry<InventoryItem, Integer> y) {
return x.getKey().toString().compareTo(y.getKey().toString()); return x.getKey().toString().compareTo(y.getKey().toString());

View File

@@ -158,7 +158,7 @@ public class BoosterDraft implements IBoosterDraft {
if (myDrafts.isEmpty()) { if (myDrafts.isEmpty()) {
SOptionPane.showMessageDialog("No custom draft files found."); SOptionPane.showMessageDialog("No custom draft files found.");
} else { } else {
myDrafts.sort(new Comparator<CustomLimited>() { Collections.sort(myDrafts, new Comparator<CustomLimited>() {
@Override @Override
public int compare(CustomLimited o1, CustomLimited o2) { public int compare(CustomLimited o1, CustomLimited o2) {
return o1.getName().compareTo(o2.getName()); return o1.getName().compareTo(o2.getName());

View File

@@ -170,7 +170,7 @@ public class CardRanker {
} }
private static List<PaperCard> sortAndCreateList(List<Pair<Double, PaperCard>> cardScores) { private static List<PaperCard> sortAndCreateList(List<Pair<Double, PaperCard>> cardScores) {
cardScores.sort(Collections.reverseOrder(new CardRankingComparator())); Collections.sort(cardScores, Collections.reverseOrder(new CardRankingComparator()));
List<PaperCard> rankedCards = new ArrayList<>(cardScores.size()); List<PaperCard> rankedCards = new ArrayList<>(cardScores.size());
for (Pair<Double, PaperCard> pair : cardScores) { for (Pair<Double, PaperCard> pair : cardScores) {

View File

@@ -1,6 +1,7 @@
package forge.match; package forge.match;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@@ -108,9 +109,9 @@ public class HostedMatch {
} }
final List<RegisteredPlayer> sortedPlayers = Lists.newArrayList(players); final List<RegisteredPlayer> sortedPlayers = Lists.newArrayList(players);
sortedPlayers.sort(new Comparator<RegisteredPlayer>() { Collections.sort(sortedPlayers, new Comparator<RegisteredPlayer>() {
@Override @Override public final int compare(final RegisteredPlayer p1, final RegisteredPlayer p2) {
public final int compare(final RegisteredPlayer p1, final RegisteredPlayer p2) {
final int v1 = p1.getPlayer() instanceof LobbyPlayerHuman ? 0 : 1; final int v1 = p1.getPlayer() instanceof LobbyPlayerHuman ? 0 : 1;
final int v2 = p2.getPlayer() instanceof LobbyPlayerHuman ? 0 : 1; final int v2 = p2.getPlayer() instanceof LobbyPlayerHuman ? 0 : 1;
return Integer.compare(v1, v2); return Integer.compare(v1, v2);

View File

@@ -206,7 +206,7 @@ final class GameClientHandler extends GameProtocolHandler<IGuiGame> {
} }
final List<RegisteredPlayer> sortedPlayers = Lists.newArrayList(players); final List<RegisteredPlayer> sortedPlayers = Lists.newArrayList(players);
sortedPlayers.sort(new Comparator<RegisteredPlayer>() { Collections.sort(sortedPlayers, new Comparator<RegisteredPlayer>() {
@Override @Override
public final int compare(final RegisteredPlayer p1, final RegisteredPlayer p2) { public final int compare(final RegisteredPlayer p1, final RegisteredPlayer p2) {
final int v1 = p1.getPlayer() instanceof LobbyPlayerHuman ? 0 : 1; final int v1 = p1.getPlayer() instanceof LobbyPlayerHuman ? 0 : 1;

View File

@@ -1146,7 +1146,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
// create sorted list from map from least to most frequent // create sorted list from map from least to most frequent
List<Entry<String, Integer>> sortedList = Lists.newArrayList(typesInDeck.entrySet()); List<Entry<String, Integer>> sortedList = Lists.newArrayList(typesInDeck.entrySet());
sortedList.sort(new Comparator<Entry<String, Integer>>() { Collections.sort(sortedList, new Comparator<Entry<String, Integer>>() {
public int compare(Entry<String, Integer> o1, Entry<String, Integer> o2) { public int compare(Entry<String, Integer> o1, Entry<String, Integer> o2) {
return o1.getValue().compareTo(o2.getValue()); return o1.getValue().compareTo(o2.getValue());
} }

View File

@@ -551,19 +551,19 @@ public final class BoosterUtils {
public static void sort(List<PaperCard> cards) { public static void sort(List<PaperCard> cards) {
//sort cards alphabetically so colors appear together and rares appear on top //sort cards alphabetically so colors appear together and rares appear on top
cards.sort(new Comparator<PaperCard>() { Collections.sort(cards, new Comparator<PaperCard>() {
@Override @Override
public int compare(PaperCard c1, PaperCard c2) { public int compare(PaperCard c1, PaperCard c2) {
return c1.getName().compareTo(c2.getName()); return c1.getName().compareTo(c2.getName());
} }
}); });
cards.sort(new Comparator<PaperCard>() { Collections.sort(cards, new Comparator<PaperCard>() {
@Override @Override
public int compare(PaperCard c1, PaperCard c2) { public int compare(PaperCard c1, PaperCard c2) {
return c1.getRules().getColor().compareTo(c2.getRules().getColor()); return c1.getRules().getColor().compareTo(c2.getRules().getColor());
} }
}); });
cards.sort(new Comparator<PaperCard>() { Collections.sort(cards, new Comparator<PaperCard>() {
@Override @Override
public int compare(PaperCard c1, PaperCard c2) { public int compare(PaperCard c1, PaperCard c2) {
return c2.getRarity().compareTo(c1.getRarity()); return c2.getRarity().compareTo(c1.getRarity());

View File

@@ -991,7 +991,7 @@ public class QuestEventDraft implements IQuestEvent {
} }
final boolean oldSetsFirst = sets.get(0).getDate().before(FModel.getMagicDb().getEditions().get("SOM").getDate()); final boolean oldSetsFirst = sets.get(0).getDate().before(FModel.getMagicDb().getEditions().get("SOM").getDate());
allowedSets.sort(new Comparator<CardEdition>() { Collections.sort(allowedSets, new Comparator<CardEdition>() {
@Override @Override
public int compare(final CardEdition edition1, final CardEdition edition2) { public int compare(final CardEdition edition1, final CardEdition edition2) {
if (edition1.getDate().before(edition2.getDate())) { if (edition1.getDate().before(edition2.getDate())) {

View File

@@ -168,7 +168,7 @@ public class QuestUtilUnlockSets {
} }
// sort by distance, then by code desc // sort by distance, then by code desc
excludedWithDistances.sort(new Comparator<ImmutablePair<CardEdition, Long>>() { Collections.sort(excludedWithDistances, new Comparator<ImmutablePair<CardEdition, Long>>() {
@Override @Override
public int compare(ImmutablePair<CardEdition, Long> o1, ImmutablePair<CardEdition, Long> o2) { public int compare(ImmutablePair<CardEdition, Long> o1, ImmutablePair<CardEdition, Long> o2) {
long delta = o2.right - o1.right; long delta = o2.right - o1.right;

View File

@@ -109,21 +109,21 @@ public abstract class AbstractTournament implements Serializable {
public void sortAllPlayers(String sortType) { public void sortAllPlayers(String sortType) {
if (sortType.equals("score")) { if (sortType.equals("score")) {
allPlayers.sort(new Comparator<TournamentPlayer>() { Collections.sort(allPlayers, new Comparator<TournamentPlayer>() {
@Override @Override
public int compare(TournamentPlayer o1, TournamentPlayer o2) { public int compare(TournamentPlayer o1, TournamentPlayer o2) {
return o2.getScore() - o1.getScore(); return o2.getScore() - o1.getScore();
} }
}); });
} else if (sortType.equals("index")) { } else if (sortType.equals("index")) {
allPlayers.sort(new Comparator<TournamentPlayer>() { Collections.sort(allPlayers, new Comparator<TournamentPlayer>() {
@Override @Override
public int compare(TournamentPlayer o1, TournamentPlayer o2) { public int compare(TournamentPlayer o1, TournamentPlayer o2) {
return o2.getIndex() - o1.getIndex(); return o2.getIndex() - o1.getIndex();
} }
}); });
} else if (sortType.equals("swiss")) { } else if (sortType.equals("swiss")) {
allPlayers.sort(new Comparator<TournamentPlayer>() { Collections.sort(allPlayers, new Comparator<TournamentPlayer>() {
@Override @Override
public int compare(TournamentPlayer o1, TournamentPlayer o2) { public int compare(TournamentPlayer o1, TournamentPlayer o2) {
return o2.getSwissScore() - o1.getSwissScore(); return o2.getSwissScore() - o1.getSwissScore();

View File

@@ -129,7 +129,7 @@ public class TournamentSwiss extends AbstractTournament {
return pairSwissGroup(players); return pairSwissGroup(players);
} }
players.sort(new Comparator<TournamentPlayer>() { Collections.sort(players, new Comparator<TournamentPlayer>() {
@Override @Override
public int compare(TournamentPlayer o1, TournamentPlayer o2) { public int compare(TournamentPlayer o1, TournamentPlayer o2) {
return availableOpponents.get(o1).size() - availableOpponents.get(o2).size(); return availableOpponents.get(o1).size() - availableOpponents.get(o2).size();