Safe publication of array/collection/map contents written once
问题 Main question: What is the best way to perform safe publication of the contents of an array, collection, or map in Java? Here is what I've tried and some side questions I have: Side question #1 On thread 1, I'm writing to an HashMap: Map<K, V> map = new HashMap<>(); map.put(key, value); My current understanding is that: Collections.unmodifiableMap() does not constitute safe publication of the references stored in the map. By examining these particular implementations of Map.of(), the result