Paul Clapham wrote:No, I think Map<Integer, Set> is a good starting point. I don't understand why you used two different types of Set in your original attempt, though. What's wrong with
I'd go with the following myself:
This allows any SortedSet implementation to be used, not just TreeSet. In the end the implementation hardly ever matters.
Of course with
Java 7 and beyond that can be shortened: