To continue what Scott Stanchfield wrote, you can use the Collections.unmodifiableXXX() methods for security, although libraries such as Google Guava may make this less necessary. Consider:
public static final Map<String, String> CAPITALS; static { Map<String, String> map = new HashMap<>();
Of course, having a 52-line static block can be disorienting, and so instead you can take a static block and turn it into a static method.
public static final Map<String, String> CAPITALS = capitals(); private static Map<String, String> capitals() { Map<String, String> map = new HashMap<>();
Difference is a matter of style. Instead, you can work with a database table.
source share