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

SortedList has wrong javadoc documentation

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 8u20
    • Component/s: javafx
    • Subcomponent:

      Description

      The SortedList javadoc states that if you create a SortedList without specifying a comparator the natural ordering of the element is used.

      This is not the actual behavior, the behavior was changed in RT-30831 without updating the javadoc. The current behavior is that the list is unordered if no comparator was explicitly set.


      IMHO the orginal behavior was much better: natural ordering has always been the default for sorting in Java and all Java developers not knowing about this exception to the rule will write buggy code.
      Moreover if you look at the following code:

          ObservableList<Event> events = FXCollections.observableArrayList();
          SortedList<Event> sortedEvents = events.sorted();

      The sortedEvents list is unordered, which is not what you expect!

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              msladecek Martin Sládeček
              Reporter:
              duke J. Duke (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported: