java - Android - How to combine two ArrayLists -
i have got 2 arraylists, created parsed html. first 1 contains jobs , like
job job b job c
and second 1 like
company company b company c
what need combination of job , company , on, can results (an arraylist great)
job : company job b : company b job c : company c
i didn't find clear tutorial or something. ideas?
are sure looking @ correct data structure achieve this?
why not use map? can define key/value relationship going route.
map<company, job> jobmap = new hashmap<company, job>(); jobmap.put("company a" /* or corresponding list item */, "job a" /* or corresponding list item */);
you may this: (swap out strings fit implementation)
map<company, list<job>> jobmap...; list<job> joblist = new arraylist<job>(); joblist.add("job a"); joblist.add("job b"); joblist.add("job c"); jobmap.put("company a", joblist);
what define company key , can set multiple jobs company
Comments
Post a Comment