title: Why isn't LinkedList.Clear() O(1)
body: <p>I was assuming LinkedList.Clear() was O(1) on a project I'm working on, as I used a LinkedList to drain a BlockingQueue in my consumer that needs high throughput, clearing and reusing the LinkedList afterwards.</p>
  
  <p>Turns out that assumption was wrong, as the (OpenJDK) code does this:</p>
  
  <pre><code>    Entry&lt;E&gt; e = header.next;
      while (e != header) {
          Entry&lt;E&gt; next = e.next;
          e.next = e.previous = null;
          e.element = null;
          e = next;
      }
  </code></pre>
  
  <p>This was a bit surprising, are there any good reason LinkedList.Clear couldn't simply "forget" its header.next and header.previous member ?</p>