Java Concurrency - Publishing Immutable Objects (Java Concurrency In Practice)
In Java Concurrency In Practice, the author stated that Immutable objects can be published through any mechanism Immutable objects can be used safely by any thread without additional synchronization, even when synchronization is not used to publish them. Does it mean that the following idioms are safe to publish immutable objects? public static List<ImmutableObject> list = new ArrayList<ImmutableObject>(); // thread A invokes this method first public static void methodA () { list.add(new ImmutableObject()); } // thread B invokes this method later public static ImmutableObject methodB () {