Will volatile work for Collections and objects?

Trying to understand the theory about volatile. They say, volatile provides happens-before, so changes done in thread 1 should be visible in thread 2.

What if we will put volatile for Collection? Will java provide visibility in Thread 2 for changes done in Thread 1 ? And why?

public class Vol {
    volatile List<String> list = new ArrayList<>();
    // thread 1
    public void put(String s) {
    // thread 2
    public List<String> get(){ // all changes are visible? "Why" for No\Yes answer
        return list;
How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum