Last active
December 1, 2020 09:34
-
-
Save pastelHex/e673de4401b544e94079f280419b90ad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.HashMap; | |
public enum EnumMap { | |
E1(1), | |
E2(2), | |
E3(3), | |
E4(4); | |
private int value; | |
public static HashMap<Integer, EnumMap> extensionMap; | |
private EnumMap(int i) { | |
this.value = i; | |
this.addToExtension(i); | |
} | |
public static EnumMap findByKey(int i) { | |
return (EnumMap)extensionMap.get(i); | |
} | |
private void addToExtension(int i) { | |
if (extensionMap == null) { | |
extensionMap = new HashMap(); | |
} | |
extensionMap.put(i, this); | |
} | |
public int getValue() { | |
return this.value; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment