Results 1 to 3 of 3

Thread: Java - LinkedList Tutorial Using JCC

  1. #1

    Thread Starter
    Hyperactive Member GamerMax5's Avatar
    Join Date
    Nov 2004
    Location
    United States
    Posts
    388

    Java - LinkedList Tutorial Using JCC

    I was peeking around on the internet for a while today and noticed that there are a lot of tutorials on the internet for Linked Lists in Java but they all re-invent the wheel. While this is great for people who don't have the first idea about LinkedLists, why re-type all that code when Java has done it for you? And there aren't many great tutorials out there for using the JCC and if they are, they tell you about the interfaces, not the actual classes.

    So I decided to write two source files that demonstrate a very simplistic use of the LinkedList class. The actual main class file is well commented explaining everything that's going on with the code while the dummy demo class is pretty much self-explainitory.

    I hope that anyone who uses it finds it useful and constructive criticism is welcome.
    Attached Files Attached Files

  2. #2
    New Member
    Join Date
    Nov 2007
    Posts
    3

    Re: Java - LinkedList Tutorial Using JCC

    A good one, but I would change this line:

    Code:
    LinkedList<Item> itemDatabase = new LinkedList<Item>();
    to

    Code:
    List<Item> itemDatabase = new LinkedList<Item>();
    The advantage would be if you decide one day to change the LinkedList to an ArrayList, there just one line, that has to be changed.

    Code:
    List<Item> itemDatabase = new ArrayList<Item>();
    With the interface you wouldn't have to change other parts of you code.

  3. #3

    Thread Starter
    Hyperactive Member GamerMax5's Avatar
    Join Date
    Nov 2004
    Location
    United States
    Posts
    388

    Re: Java - LinkedList Tutorial Using JCC

    Thanks for the heads-up. I wasn't really thinking "outside-the-box" when I wrote that. More or less I was flared up on how irritating it was for me to try and find something to help me with that topic.

Posting Permissions

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



Click Here to Expand Forum to Full Width