-
Bug
-
Resolution: Fixed
-
P4
-
None
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 inRT-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!
This is not the actual behavior, the behavior was changed in
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!
- relates to
-
JDK-8094532 ObservableList.sorted() does nothing
- Resolved