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

Unsorted mode in the SortedList


    • Subcomponent:


      When a SortedList wraps an ObservableList, the first thing it is going to do is to create an array of Elements and sort the list. Performance is one thing when the original list is large. There is also no way to return to the unsorted order. Take TableView as an example. A sortable TableView should support unsorted state, as RT-19487 mentioned. If using SortedList with TableView, there is no way to return to unsorted state. Because of the time spent creating the Element array, it will take a long time to create a TableView if using SortedList. A possible solution is to not use SortedList initially and only use it when user sorts it. However, that'll involve changing the TableView's items property on fly which doesn't sound like a good idea. My suggestions are

      1. Do not sort nor create the Element array until the setComparator is called with a valid comparator. If null is set as comparator, it should be unsorted.

      2. In the unsorted state, all events in the observablelist should be propagated as if the SortedList doesn't exist.


          Issue Links



              • Assignee:
                msladecek Martin Sládeček
                dqiaojfx David Qiao (Inactive)
              • Votes:
                0 Vote for this issue
                6 Start watching this issue


                • Created: