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

[SortedList] add() to underlying list throws IndexOutOfBoundsException if item not successfully added

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 8
    • Fix Version/s: None
    • Component/s: javafx
    • Environment:

      Windows 7 Professional SP1 x64, JavaFX 8 EA b128

    • Subcomponent:

      Description

      1. Create your own List implementation including iterators and make sure it works with ObservableList as a wrapper.
      2. Make the add* methods not actually add anything.
      3. Create a new instance of the list and wrap it in ObservableList, store it in "list" variable.
      4. Wrap the ObservableList in SortedList.
      5. Perform list.add(...).

      I use my own List+Set implementation (ArrayHashList, LinkedHashList), whose instance is a list with no duplicates in it. Very useful thing. It however does not work with the SortedList wrapper because if I do this, I get the IndexOutOfBoundsException:

      final ObservableList<String> list = FXCollections.observableList(new ArrayHashList<String>());
      final ObservableList<String> sortedList = new SortedList<String>(list, String.CASE_INSENSITIVE_ORDER);
      list.add("a");
      list.add("a"); // Does not change the list

        Attachments

          Activity

            People

            • Assignee:
              msladecek Martin Sládeček
              Reporter:
              jsmucrjfx Jan Smucr (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: