For exmple, i have undefined number of a pairs(key, value). And I want to build sorted list during iterate trough this pairs(it is long operation).
I think to use a BinaryTree as a sorted structure and build list from tree after iterations.
How you think in generally, is this method faster than simple sorting of the list getted from iterate trough the pairs?
What the best way to resolve this issue?
Is some java API items for this issue?