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 ?
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.