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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.