I am in need of a data structure, like:
Map<String, List<Profile>> profilePool;
What I need is the list to each key should be sorted. I can do it manually while doing profilePool.put()
using some compare objecst on some attribute to keep the list ordered against the key.
But can we have a compare function attached to the List<> so that whenever a object is inserted into the list, it should place it at a specific index, maintaining the order?
Or do we have any other data structure, easy to use and does the same task?