From 7344a15a9bfe7751abd60c9199fb1074c818463d Mon Sep 17 00:00:00 2001 From: igoudt Date: Sun, 18 Mar 2018 00:56:52 +0100 Subject: [PATCH] remove comparator, use Comparator.comparing --- .../java/mage/target/common/TargetCardInLibrary.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Mage/src/main/java/mage/target/common/TargetCardInLibrary.java b/Mage/src/main/java/mage/target/common/TargetCardInLibrary.java index b23298e107..6d7b588ef6 100644 --- a/Mage/src/main/java/mage/target/common/TargetCardInLibrary.java +++ b/Mage/src/main/java/mage/target/common/TargetCardInLibrary.java @@ -31,6 +31,8 @@ import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.UUID; + +import mage.MageObject; import mage.abilities.Ability; import mage.cards.Card; import mage.cards.Cards; @@ -91,7 +93,7 @@ public class TargetCardInLibrary extends TargetCard { } else { cards = new ArrayList<>(targetPlayer.getLibrary().getTopCards(game, librarySearchLimit)); } - cards.sort(new CardNameComparator()); + cards.sort(Comparator.comparing(MageObject::getName)); Cards cardsId = new CardsImpl(); for (Card card : cards) { cardsId.add(card); @@ -129,10 +131,3 @@ public class TargetCardInLibrary extends TargetCard { } -class CardNameComparator implements Comparator { - - @Override - public int compare(Card o1, Card o2) { - return o1.getName().compareTo(o2.getName()); - } -}