Java concurrency: is final field (initialized in constructor) thread-safe?
问题 Can anyone tell me whether this class is threadsafe or not ? class Foo { private final Map<String,String> aMap; public Foo() { aMap = new HashMap<String, String>(); aMap.put(\"1\", \"a\"); aMap.put(\"2\", \"b\"); aMap.put(\"3\", \"c\"); } public String get(String key) { return aMap.get(key); } } Edit: It my fault to not clarify the question. According to JMM FAQ : A new guarantee of initialization safety should be provided. If an object is properly constructed (which means that references to