Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8354111

JavaDoc states that Iterator.remove() is linear in the LinkedBlockingDeque

XMLWordPrintable

      ADDITIONAL SYSTEM INFORMATION :
      All Java versions

      A DESCRIPTION OF THE PROBLEM :
      One of the features of the LinkedBlockingDeque is that it is a doubly-linked node queue, with pointers in each node to "prev" and "next", which allows remove() in the Iterator to remove the node in constant time. However, in the JavaDoc of the class, it lists Iterator.remove() as an example of a method that takes linear time.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Look at the JavaDoc in java.util.concurrent.LinkedBlockingDeque

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
       * <p>Most operations run in constant time (ignoring time spent
       * blocking). Exceptions include {@link #remove(Object) remove},
       * {@link #removeFirstOccurrence removeFirstOccurrence}, {@link
       * #removeLastOccurrence removeLastOccurrence}, {@link #contains
       * contains}, and the bulk operations, all of which run in linear
       * time.

      ACTUAL -
       * <p>Most operations run in constant time (ignoring time spent
       * blocking). Exceptions include {@link #remove(Object) remove},
       * {@link #removeFirstOccurrence removeFirstOccurrence}, {@link
       * #removeLastOccurrence removeLastOccurrence}, {@link #contains
       * contains}, {@link #iterator iterator.remove()}, and the bulk
       * operations, all of which run in linear time.


      ---------- BEGIN SOURCE ----------
      No test code necessary.
      ---------- END SOURCE ----------

            hkabutz Heinz Kabutz
            webbuggrp Webbug Group
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: