hi all, i have a programming assignment where i read a text file through command line arguments. i then use that information to get a list of photos (just strings, not actual images) and a list of keywords that correspond to each of those photos.

i am stuck on how to build these lists so i can access them to find a list of keywords for each photo and also to find a list of photos for each keyword. i was fiddling around with arraylists and linkedlists, but i wasn't coming up with the right tactic.

i can clarify any questions anybody has about this problem.

6 Years
Discussion Span
Last Post by JamesCherrill

How about a HashMap<String, ArrayList<String>> ?
Hashmap has photo name as key, list of keywords as value.
Get list of keywords for a photo is trivial, list of photos for a keyword is easy using contains(keyword) on each of the keyword lists in a loop.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.