I have an interface:
List<List<Integer>> separate(List<Integer> list);
I want to be able to separate the parameterized list into separate integer lists based on if the values within the list object are the same so if the list was {1, 1, 5, 7, 9} it would create 4 separate lists:
{1, 1}{5}{7}{9}
Is there an easy library to use for this? I can quite easily come up with an algorithm which does this but if the elements in the list were not Integers but Objects and you wanted to base the grouping rules on some fields within it then how would I go about doing that?
Thanks very much for any help.