I’m adding and removing TAGS(strings) inside the “comment” sections of MP3 files. I am mainly relying on ArrayList to get the COMMENT string split. Now I want to find the intersection of these tags (or better to say string elements of ArrayList).
I need to know if I have chosen the right collection, also whats a best way to find these intersections ? Because a user might select 10s or 100s of songs (ArrayLists) and ask for the intersecting tag. Should I individually look for the intersecting tags of TWO ArrayLists and then use the result to look against the 3rd ArrayList and so on ? or do I need to change my data structure.
Sorry for writing an essay.
If you want to compute intersections, you should almost certainly be using a
Setrather than aList. Sets are great for handling unordered collections and operations like union and intersection (withremoveAllandretainAll). They are also more efficient for answering questions like “is this element contained in the collection?”Hope this helps!