Permanent connection to an ArrayList
Say I have an ArrayList of Song objects called lib. Imagine this is my song library.
How I currently have my playlists set up, is that I have a separate Playlist object with another ArrayList of Song objects, called listSongs.
When I add songs to the playlist, it accepts an array of ints and uses this to calculate which Song objects should be duplicated in the listSongs ArrayList.
This works fine, but things get complicated when I do somethings like a delete a song form the main library, because then it has to bugger around deleting the songs from each playlist as well.
I played with keeping the playlist as an array of ints, with the ArrayList only calculated when it needs to be displayed, but this created more trouble.
Is there some way that the Playlist object can rather have a list of connections to the elements in the main lib ArrayList - shortcuts to the Song objects or something?