private final static Map<String,String> map = Collections.unmodifiableMap(new HashMap<String,String>() {
{
put("key1", "value1");
put("key2", "value2");
}
});
Initializing a static final (unmodifiable) Collection:
private final static Set<String> set = Collections.unmodifiableSet(new HashSet<String>() {
{
add("value1");
add("value2");
}
});
No comments:
Post a Comment