Reputation: 1550
I am having a array like String[] selectedJobs = {"job,1","job,2", "Job2,1", "job3,1"};
I want to extract information like
Job -> 1,2
Job2 -> 1
Job3 -> 1
Map<String, List<String>> jobs = new HashMap<String, List<String>>();
and I want to store each job with corresponding list of integers in map.
How to do this ?
Upvotes: 0
Views: 90
Reputation: 328618
Upvotes: 2
Reputation: 15675
What have you tried? The algorithm shouldn't be tricky: Go through your array, split on "," for each String, and put it in the HashMap you describe.
Upvotes: 1