Given the class:
public class CategoryValuePair
{
String category;
String value;
}
And a method:
public Map<String,List<String>> convert(CategoryValuePair[] values);
Given that in values we can receive many entries with the same category, I want to convert these into a Map grouped on category.
Is there a quick / efficient way to perform this conversion?
String[]instead ofList<String>in your map? I can't think of very many reasons why the array would be better, and with regards to your question, the way I'm thinking, the list would make it a bit easier.