Suppose you have a supermarket, and every item which belongs in that supermarket is stored in one place.
Then you have sections of the supermarket like "Food & Cuisine", "Entertainment" and so on.
The user of your program needs to be able to list every item within the supermarket, then distinctly list every item within each of the sections. When printing data, the same item must not be repeated.
So I believe what would need to be done is that everytime a new item is added - it will need to be stored in an initial place (in an ArrayList or something), then it will also need to be stored in each section (for which it belongs). But I'm worried this may be 'duplication' of data since the same information is being stored in two different places.
This method would mean that everytime an item needs to be deleted - it will need to be deleted from the initial list of all items in the market, it would also need to be deleted from whichever sections they belong which would mean the program's running costs will increase a lot in very little time. Is there a way that instead of storing the data in two places, the data can just be referenced from the initial list of all items?