title: Does the value of AtomicReference will be set lazily if we assign a function to it which returns some array?
body: <p>I have this piece of code:</p>
  <pre><code>AtomicReference&lt;List&lt;String&gt;&gt; atomicStrings = new AtomicReference&lt;&gt;();
  atomicStrings.set(someFunc());
  Thread.sleep(10000);
  System.out.print(String.join(&quot;,&quot;, atomicStrings.get()); // will this print a,b,c ?
  </code></pre>
  <p>Where</p>
  <pre><code>private List&lt;String&gt; someFunc() {
      List&lt;String&gt; list = new ArrayList&lt;&gt;();
  
      new Thread(() -&gt; {
        try {
          list.add(&quot;a&quot;);
          Thread.sleep(1000);
          list.add(&quot;b&quot;);
          Thread.sleep(1000);
          list.add(&quot;c&quot;);
          Thread.sleep(1000);
        } catch (Exception e) {
          e.printStackTrace();
        }
      }).start();
  
      return list;
  }
  </code></pre>
  <p>Of course this is a very poor example but i tried to mimic my real test case here by adding delays. My question here is that since someFunc() returns the array right away and the array elements are populated in a different thread, but the result we get is stored in an AtomicReference and we don't get the value until later, the delay i am adding in the main function is more than the delay the new thread spawned will take. Will my returned array be populated will all the elements?</p>