title: Static nested class in Java, why?
body: <p>I was looking at the Java code for <code>LinkedList</code> and noticed that it made use of a static nested class, <code>Entry</code>.</p>
  
  <pre><code>public class LinkedList&lt;E&gt; ... {
  ...
  
   private static class Entry&lt;E&gt; { ... }
  
  }
  </code></pre>
  
  <p>What is the reason for using a static nested class, rather than an normal inner class?</p>
  
  <p>The only reason I could think of, was that Entry doesn't have access to instance variables, so from an OOP point of view it has better encapsulation. </p>
  
  <p>But I thought there might be other reasons, maybe performance. What might it be?</p>
  
  <p>Note. I hope I have got my terms correct, I would have called it a static inner class, but I think this is wrong: <a href="http://java.sun.com/docs/books/tutorial/java/javaOO/nested.html" rel="noreferrer">http://java.sun.com/docs/books/tutorial/java/javaOO/nested.html</a></p>