To "null" or not to "null" my class's attributes
<p>When I write a class in Java, I like to initialize the attributes which are set to a default value directly and attributes which are set by the caller in the constructor, something like this:</p>

<pre><code>public class Stack&lt;E&gt; {
    private List&lt;E&gt; list;
    private int size = 0;

    public Stack(int initialCapacity) {
        list = new ArrayList&lt;E&gt;(initialCapacity);
    }

    // remainder omitted
}
</code></pre>

<p>Now suppose I have a Tree class:</p>

<pre><code>public class Tree&lt;E&gt; {
    private Node&lt;E&gt; root = null;

    // no constructor needed, remainder omitted
}
</code></pre>

<p>Shall I set the root attribute to null, to mark that it is set to null by default, or omit the null value?</p>

<p><strong>EDIT:</strong></p>

<p>I came up with that idea after reading the sources of <a href="http://www.docjar.com/html/api/java/util/LinkedList.java.html" rel="nofollow">LinkedList</a> and <a href="http://www.docjar.com/html/api/java/util/ArrayList.java.html" rel="nofollow">ArrayList</a>, which both clearly set their attributes (size in LinkedList and firstIndex/lastIndex in ArrayList) to 0.</p>
