title: Can an iterator prevent its LinkedList from being garbage collected?
body: <p>In Java, is it safe to create a LinkedList in a method and return its iterator like so:</p>
  
  <pre><code>public Iterator&lt;Integer&gt; iterator()
  {
     LinkedList&lt;Integer&gt; list = new LinkedList&lt;&gt;();
     list.add(1);
     return list.iterator();
  }
  </code></pre>
  
  <p>Is there any chance the list will be garbage-collected after the method returns?</p>