I have a scenario where i am given a file that contains info such as: (just a sample)

img01.jpg|Washington DC|aquarium|puffer fish|seahorse
img02.jpg|CHICAGO|AQUARIUM
img03.jpg|Chicago|fish

where the first section is the "image" (just a made-up name, not an actual image) and the rest of the words are keywords. ive been able to separate the file fine, but part of the assignment is to have to user enter a keyword and have all "images" with those keywords be listed. i am confused on which way i should store these words.

i need to have something that can link a keyword with the "image". however, the amount of keywords for any given image is variable, so that sort of rules out fixed sized arrays, correct?

i need to have something that can link a keyword with the "image".

Look at the Map class or its extensions. The value could be a list of the images associated with the keyword.

Is the "image" an object containing an image or is it a String?

Edited 6 Years Ago by NormR1: n/a

its just a string, so when you search for a keyword, if there are any hits, the image string is displayed (ex. img01.jpg displayed if keyword seahorse is entered)

This question has already been answered. Start a new discussion instead.