Skip to content

Instantly share code, notes, and snippets.

@chris-martin
Created July 18, 2013 00:55
Show Gist options
  • Save chris-martin/6025894 to your computer and use it in GitHub Desktop.
Save chris-martin/6025894 to your computer and use it in GitHub Desktop.
enum EnumBullshit {
A(5), B(6), C(-4);
public final int i;
private static final Map<Integer, EnumBullshit> map = new HashMap<>();
static {
for (EnumBullshit bullshit : values()) {
map.put(bullshit.i, bullshit);
}
}
private EnumBullshit(int i) {
this.i = i;
}
public static EnumBullshit get(int i) {
return map.get(i);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment