From 595b438faa8fc4052c4f3ce6d951d8f5a039bc0a Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sun, 12 Jan 2020 13:30:18 -0500 Subject: [PATCH] updated SagaChapter getChapter method --- .../main/java/mage/constants/SagaChapter.java | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/Mage/src/main/java/mage/constants/SagaChapter.java b/Mage/src/main/java/mage/constants/SagaChapter.java index 17b1e95117..056f425fd4 100644 --- a/Mage/src/main/java/mage/constants/SagaChapter.java +++ b/Mage/src/main/java/mage/constants/SagaChapter.java @@ -1,9 +1,5 @@ package mage.constants; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - /** * @author LevelX2 */ @@ -13,8 +9,6 @@ public enum SagaChapter { CHAPTER_III(3, "III"), CHAPTER_IV(4, "IV"); - private static final Map chapterMap = new HashMap(); - private final String text; private final int number; @@ -33,14 +27,11 @@ public enum SagaChapter { } public static SagaChapter getChapter(int number) { - initMap(); - return chapterMap.get(number); - } - - private static void initMap() { - if (!chapterMap.isEmpty()) { - return; + for (SagaChapter sagaChapter : SagaChapter.values()) { + if (sagaChapter.getNumber() == number) { + return sagaChapter; + } } - Arrays.stream(SagaChapter.values()).forEach(sagaChapter -> chapterMap.put(sagaChapter.getNumber(), sagaChapter)); + return null; } }