静态HashMap 初始化填充

public class ExampleClass {
	public final static HashMap consts = new HashMap();
	static{
		constants.put("A", "The Letter A"); 
		constants.put("B", "The Letter B"); 
		constants.put("C", "The Letter C"); 
	} 
/* Rest of your class that needs to know the consts */
}

A simple example of how to initialize a static hash map in java

你可能感兴趣的:(java,C++,c,C#,REST)