Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I'm writing a program that stores music information. I have a class called Song that holds song information (song ID, song name, length etc.) and class called Playlist that holds an integer essentially (that references the song ID) and I have a linked list class. (I'm writing my own lists because this is a data structures class). My problem is that I need to be able to dynamically create playlists because the user is supposed to be able to make as many as they want. My professor suggested using a list of lists, but he is being very vague with the syntax. Basically I want a List(of strings i.e. the name of the playlist) that contains lists of the Playlist class. my general understanding of constructing this is (assuming my list class is called "List":
List<List<Playlist> > playList;Now theoretically if I have an insert operator in the List class, I can insert a string for a playlist (i.e. "Classical_Songs"), but I'm not sure how to do it. (playList.insert(somename);?) Futhermore, if I actually want to edit the contents of the list "Class Songs" and add song id numbers, I have no idea where to start. Would I just be able to use "Classical _Songs.insert(somevalue); ?
Any help would be GREATLY appreciated.

It would depend on the contents of your List<T> class, but I suspect you more-or-less have it.
List<List<Playlist> > playList;
That would create a List of Lists (of Playlists).playList.insert(somename);
Again, it would depend on your insert, but I assume that would have to insert a List<Playlist>, not a Song.Classical _Songs.insert(somevalue);
You would have to reference your Classical_Songs from the master list class.The easiest way to go about it would probably be to make it work for a single List<Playlist>, then go back and add the master List<List<Playlist> > playList;.
I'd love to be of more help, but I don't get your description, and you didn't post any source code.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |