Results 1 to 2 of 2
  1. #1
    newtojava7 is offline Member
    Join Date
    Jan 2008
    Posts
    16
    Rep Power
    0

    Default arraylists problem

    hi

    im working on a song manager for an assignment. ive gotten the program to store every mp3's artist and song name into two respective arraylists. then i display the contents of these array lists in two J-Lists, one named artists and another named songs.

    so say I have a folder containing just madonna songs and say she has 5 songs:

    madonna - a
    madonna - b
    madonna - c
    madonna - d
    madonna - e

    where the letters represent songs. whats happening right now is it stores each madonna song just fine since they are different names, however for the artist JList the madonna is repeating 5 times since its being stored in the array list 5 times, since my program is finding her name 5 times. how can I get it to store madonnas name only once, so that under my artist JList her name appears only once. obviously under the artists i want each artists name appearing only once, regardless of how many songs they have.

    thanks in advance

  2. #2
    saint_jorjo is offline Member
    Join Date
    Mar 2008
    Posts
    7
    Rep Power
    0

    Default

    you have to made arraylist to arraylist
    ArrayList madonna = new Arr...
    ArrayList singer = new Arr...
    madonna.add(a);....
    ...
    singer.add(madonna);

Similar Threads

  1. A Map implemented with ArrayLists
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-16-2008, 10:29 PM
  2. recursively searching through arraylists
    By newtojava7 in forum New To Java
    Replies: 1
    Last Post: 03-17-2008, 02:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •