From: "Enrico Weigelt, metux IT consult" <[email protected]>
---
src/net/sf/freecol/FreeCol.java | 11 ++++++++---
src/net/sf/freecol/common/i18n/Messages.java | 12 ------------
2 files changed, 8 insertions(+), 15 deletions(-)
diff --git a/src/net/sf/freecol/FreeCol.java b/src/net/sf/freecol/FreeCol.java
index 39a5d4565cf..cb1595c9a87 100644
--- a/src/net/sf/freecol/FreeCol.java
+++ b/src/net/sf/freecol/FreeCol.java
@@ -57,6 +57,7 @@ import net.sf.freecol.common.option.OptionGroup;
import static net.sf.freecol.common.util.CollectionUtils.*;
import net.sf.freecol.common.util.LogBuilder;
import net.sf.freecol.common.util.StrCat;
+import net.sf.freecol.common.util.Utils;
import net.sf.freecol.server.FreeColServer;
import org.apache.commons.cli.CommandLine;
@@ -980,9 +981,13 @@ public final class FreeCol {
* @return The type of advantages set, or null if none.
*/
private static Advantages selectAdvantages(String as) {
- Advantages a = find(Advantages.values(), Messages.matchesNamed(as));
- if (a != null) setAdvantages(a);
- return a;
+ for (Advantages a : Advantages.values()) {
+ if (Utils.equals(Messages.getName(a), as)) {
+ setAdvantages(a);
+ return a;
+ }
+ }
+ return null;
}
/**
diff --git a/src/net/sf/freecol/common/i18n/Messages.java
b/src/net/sf/freecol/common/i18n/Messages.java
index 857609fa30c..169b46c00ca 100644
--- a/src/net/sf/freecol/common/i18n/Messages.java
+++ b/src/net/sf/freecol/common/i18n/Messages.java
@@ -32,7 +32,6 @@ import java.util.Locale;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
-import java.util.function.Predicate;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -467,17 +466,6 @@ public class Messages {
return new String[] { name, desc };
}
- /**
- * A predicate maker to match named types.
- *
- * @param key The name of the type.
- * @return A suitable {@code Predicate}.
- */
- public static final Predicate<Named> matchesNamed(String key) {
- return matchKeyEquals(key, (Named k) -> Messages.getName(k));
- }
-
-
// Special purpose unit labelling
/**
--
2.11.0.rc0.7.gbe5a750
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Freecol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freecol-developers