title: Java:Delete all the elements from Linked List
body: <p>In Java, how to remove all the elements in linked list <strong>without</strong> using already available <strong><code>clear()</code></strong> method?  This exercise was inspired by a question received in a phone interview.</p>
  
  <p>Say I can do this in C</p>
  
  <pre><code>void DeleteAllElement( ListElement **head ) {  
      ListElement *deleteMe = *head;  
      while( deleteMe )  {  
          ListElement *next = deleteMe-&gt;next;  
          delete deleteMe;  
          deleteMe = next;  
      }  
      *head = NULL;  
  }
  </code></pre>
  
  <p>Thanks</p>