Results 1 to 4 of 4
  1. #1
    jumoo is offline Member
    Join Date
    Aug 2011
    Posts
    8
    Rep Power
    0

    Default I need help using LinkedList :) Thanks (homework)

    Java Code:
    private LinkedList<Account> friends = new LinkedList<Account>();
    
    public Account(int id, String name, String dob, String word)
        {
            this.id = id;
            this.name = name;
            this.dob = dob;
            password = new Password(word);
        }
    
    public LinkedList<Account> getFriendList()
        {
            return friends;
        }
    The scenario is I wanted to get only the name from the friend list, not the id, dob, and password.

    Can someone help me how do I configure my getFriendList() method?

    Cheers.
    Last edited by sunde887; 12-11-2011 at 06:32 AM. Reason: Added code tags, [code]...[/code]

  2. #2
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default Re: I need help using LinkedList :) Thanks (homework)

    I'm not sure of your question. What is stopping you from retrieving the name? The idea of this is to use a data structure to hold a series of Account objects. You can traverse the list, and then use selectors to extract the proper information.

  3. #3
    jumoo is offline Member
    Join Date
    Aug 2011
    Posts
    8
    Rep Power
    0

    Default Re: I need help using LinkedList :) Thanks (homework)

    Oh I mean, I only wanted to select the name and display it. how do you use selector? can you give me an example?

  4. #4
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

Similar Threads

  1. Need help with LinkedList.
    By fsuarjun03 in forum New To Java
    Replies: 0
    Last Post: 04-18-2011, 08:27 PM
  2. I need help in LinkedList ...
    By Usman in forum Advanced Java
    Replies: 3
    Last Post: 03-25-2011, 02:38 AM
  3. LinkedList
    By [RaIdEn] in forum New To Java
    Replies: 7
    Last Post: 10-13-2009, 01:59 AM
  4. LinkedList help
    By jigglywiggly in forum New To Java
    Replies: 6
    Last Post: 09-19-2009, 08:24 AM
  5. how to use LinkedList
    By fred in forum Advanced Java
    Replies: 1
    Last Post: 07-24-2007, 02:52 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
  •