In short, if you want to write a map of e.g. constants in Java, which in e.g. Python and Javascript you would write as a literal,
T CON
Constants? I'd use an enum.
public enum Constants {
NAME_1("Value1"),
NAME_2("Value2"),
NAME_3("Value3");
private String value;
Constants(String value) {
this.value = value;
}
public String value() {
return value;
}
}
Value for e.g. NAME_2
can be obtained as follows:
String name2value = Constants.NAME_2.value();
Only give the enum a bit more sensible name, e.g. Settings
, Defaults
, etc, whatever those name/value pairs actually represent.