Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: MP3 catalogue with favorites (ArrayList)

  1. #1
    Junior Member
    Join Date
    Nov 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default MP3 catalogue with favorites (ArrayList)

    Hi I'm first year student writing a MP3 catalogue for my fist assignment. It has all the usual functions EG add track, delete track, swap tracks and sort track by name, title, artist etc. All communication is via the console window.

    I have a main, MP3Track, MP3Interface and several comparator classes. Main calls static methods such as addTrack, searchCat, moveTrack and trackExists etc. MP3Track contains data members such as trackNo, trackName, artist, album & length. My collection is stored in an ArrayList.

    MoveTrack swaps two track numbers if they exist.

    I would like to add a favorites function.

    Typical output below FYI

    Capture.jpg

    I was thinking that one possible option would be to add an extra data member in MP3Track (boolean inFav) flagging if this in or isn't. Then iterating through the collection and extracting favorites for manipulation etc.

    (Or)

    To have another collection (what type of?) for favorites pointing to the original. One of the problems I can see with this is if a user adds a track number to favorites and then later swaps track numbers in the main collection my favorites will now contain a track I didn't choose to be there!! (I think). I want them to be able to add a track either by tack number or title. Am I right and if so how could I overcome this. Or maybe I've got this all wrong... maybe using a Set as they don't hold duplicates!

    ...all suggestions, improvements, pointers and advice much appreciated.

    Great site BTW and I hope to be able to contribute one day.

    Thanks in advance for any help.


  2. #2
    Junior Member
    Join Date
    Nov 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default MP3 catalogue with favorites (ArrayList)

    Hi I'm first year student writing a MP3 catalogue for my fist assignment. It has all the usual functions EG add track, delete track, swap tracks and sort track by name, title, aritst etc. All communication is via the console window.

    I have a main, MP3Track, MP3Interface and several comparator classes. Main calls static methods such as addTrack, searchCat, moveTrack and trackExists etc. MP3Track contains data members such as trackNo, trackName, artist, album & length. My collection is stored in an ArrayList.

    MoveTrack swaps two track numbers if they exist.

    I would like to add a favorites function.

    Typical output below FYI

    Capture.jpg

    I was thinking that one possible option would be to add an extra data member in MP3Track (boolean inFav) flagging if this in or isn't. Then iterating through the collection and extracting favorites for manipulation etc.

    (Or)

    To have another collection (what type of?) for favorites pointing to the original. One of the problems I can see with this is if a user adds a track number to favorites and then later swaps track numbers in the main collection my favorites will now contain a track I didn't choose to be there!! (I think). I want them to be able to add a track either by tack number or title. Am I right and if so how could I overcome this. Or maybe I've got this all wrong...

    ...all suggestions, improvements, pointers and advice much appreciated.

    Thanks in advance for any help.

  3. #3
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    6,304
    My Mood
    Mellow
    Thanks
    252
    Thanked 778 Times in 763 Posts

    Default Re: MP3 catalogue with favorites (ArrayList)

    Please don't post duplicate topics. It doesn't get you help faster, and keeping track of the thread in two places makes it harder for those wanting to help.

    I'll answer in the Collections topic, because that's probably where it goes best.

  4. #4
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    6,304
    My Mood
    Mellow
    Thanks
    252
    Thanked 778 Times in 763 Posts

    Default Re: MP3 catalogue with favorites (ArrayList)

    Posted pictures or screen captures don't work well. They're just too small. You should be able to copy the result from your terminal and post that, if it's really necessary. In this case, I'm not sure it is.

    I think your first option is the best: add a boolean field that tracks favorite status. You could create another collection of favorites, but then you'd be required to keep it current with the user's latest changes. Not a big deal, but it kind of defeats the purpose of having objects that define themselves with their attributes. Keeping the same data in multiple places just becomes a management headache unless there's a significant processing benefit which isn't likely true here.

  5. #5
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,307
    Thanks
    56
    Thanked 2,373 Times in 2,344 Posts

    Default Re: MP3 catalogue with favorites (ArrayList)

    If you don't understand my answer, don't ignore it, ask a question.

  6. #6
    Junior Member
    Join Date
    Nov 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: MP3 catalogue with favorites (ArrayList)

    It wasn't intentional...the repost

Similar Threads

  1. Your Favorites in Anything
    By Andrew R in forum Totally Off Topic
    Replies: 1
    Last Post: August 14th, 2013, 03:27 PM
  2. mp3 file cant be resolved
    By aNGaJe in forum What's Wrong With My Code?
    Replies: 3
    Last Post: February 2nd, 2012, 07:20 AM
  3. Java mp3 Player
    By aNGaJe in forum Java Theory & Questions
    Replies: 1
    Last Post: October 21st, 2011, 10:49 AM
  4. MP3 problems
    By relion65 in forum What's Wrong With My Code?
    Replies: 6
    Last Post: July 15th, 2011, 01:09 PM
  5. Bookmarks/Favorites Menu
    By oiradranlom in forum Java Theory & Questions
    Replies: 3
    Last Post: April 30th, 2010, 12:29 PM

Tags for this Thread