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

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

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 25
    • core-libs
    • None
    • behavioral
    • minimal
    • The current behavior of the LinkedBlockingDeque is already constant time for iterator.remove().
    • Java API
    • SE

      Summary

      Change the JavaDoc of LinkedBlockingDeque to be more precise about the linear cost of iterator.remove().

      Problem

      The JavaDoc states that the cost of iterator.remove() is linear, but a LBD would need doubly-linked nodes, which should be able to remove a node in constant time. The cost would likely be linear in LinkedBlockingQueue, but not in LinkedBlockingDeque.

      Solution

      Change the JavaDoc to remove the reference to iterator.remove() as being linear cost.

      Specification

      Change the text of the JavaDoc in LinkedBlockingDeque to the following:

       * <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.

            hkabutz Heinz Kabutz
            webbuggrp Webbug Group
            Chen Liang, Stuart Marks
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: