Going through elements in treeset and update the sorting in Java -
i have 3 set of 3 sets , want algorithmically:
for first treeset in treesets till done: dosomething(treeset) if done(treeset) { remove treeset treesets sort treesets // next treeset dosomething first treeset in treesets since change sorting want make sure sorting applied there } }
what best way of doing that? simple example:
treeset1 treeset2 treeset3 treeset4
go treeset1, on it, if done, remove treeset1, sort, next element become treeset4 (originally treeset2), on treeset4, not done, not remove treesert4, sort again, next treeset3, something, done, treeset3 done, sort again, again treeset4 comes in sortting, on treeset4 .....
what best practice? have sorting function works. algorithm stop once reach last element , not remove more element.
i figured out iterator. after each loop, resort iterator , call next(). solved problem.
Comments
Post a Comment