Javadoc for java.util.List states an index range that is off-by-one

XMLWordPrintable

    • Type: Bug
    • Resolution: Not an Issue
    • Priority: P4
    • tbd
    • Affects Version/s: 8, 11, 17, 21, 25.0.1
    • Component/s: core-libs

      A DESCRIPTION OF THE PROBLEM :
      The Java 25 (and earlier) Javadoc for java.util.List.listIterator() says, "Throws: IndexOutOfBoundsException - if the index is out of range (index < 0 || index > size())"

      I think the invalid range should be: "(index < 0 || index >= size())"

      Note the added equals sign. The same applies for methods: subList(), add(), and addAll().

      FREQUENCY :
      ALWAYS

            Assignee:
            Stuart Marks
            Reporter:
            Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: