Sort a large collection while showing progress

后端 未结 7 793
广开言路
广开言路 2021-01-02 22:58

What is the best way to sort a collection while updating a progress bar? Currently I have code like this:

for (int i = 0; i < items.size(); i++)
{
    pro         


        
7条回答
  •  时光说笑
    2021-01-02 23:37

    Why not implement your own merge sort (which is what Collections.sort is doing) and update the progress bar at key points of the algorithm (say, after each merge of more than 5% of the array)?

提交回复
热议问题