When adding large amount of elements in java, it might be really costly to sort the list after inserting the items or sort the list as the items are being inserted. I was looking for a collection that inserts the item in the correct position from the start. I know about sorted sets, but sorted sets eliminates duplicates. What if I need the duplicates to be in my list?
Asked
Active
Viewed 57 times
0
-
This should help https://stackoverflow.com/questions/8725387/why-is-there-no-sortedlist-in-java – Ajinkya Taranekar Jan 04 '20 at 07:47
-
1Does this answer your question? [Why is there no SortedList in Java?](https://stackoverflow.com/questions/8725387/why-is-there-no-sortedlist-in-java) – Ajinkya Taranekar Jan 04 '20 at 07:49
-
I read those answers before. They are pretty old. I'm asking if such collection exists or not – Mohamed G. AbdelHady Jan 04 '20 at 11:43