check if an object is null
<p>I have a linked list in which first node contains null object. means firstNode.data is equal to null, firstNode.nextPointer = null, firstNode.previousPointer = null.</p>

<p>And I want to check if firstNode is null or not.
So I tried-</p>

<pre><code>if(list.firstNode == null){

            //do stuff          
        }
</code></pre>

<p>but this doesn't works?</p>

<p>I also tried equals too. Any suggestions?</p>

<p>I tried printing. And I got as-</p>

<p>{null} -- firstNode</p>
