Results 1 to 6 of 6
  1. #1
    jumpydady is offline Member
    Join Date
    Apr 2012
    Posts
    3
    Rep Power
    0

    Default converting linked list to sortedset

    hi i have a question, i have a linked list and i have a method that returns a sortedset of that object how do i make the convertion?
    tried to use collection.sort(), but wat am i suposed to return? the eclipse says its an error if i try to return the object...

    public SortedSet<Object> getObject() {
    Collections.sort(Object);
    return ?????Object??? ;
    }



    thx

  2. #2
    jumpydady is offline Member
    Join Date
    Apr 2012
    Posts
    3
    Rep Power
    0

    Default Re: converting linked list to sortedset

    plz need this solution Q_Q in dispair and hurry

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: converting linked list to sortedset

    Your question is hard to understand in that it's very sparse on details and is written poorly. Please consider giving us more details on your current code, your exact and specific requirements. Also please try to use standard English without non-standard abbreviations or misspellings. It's hard enough to try to to decipher what is going wrong with your program that we don't need additional roadblocks put in our way.

  4. #4
    jumpydady is offline Member
    Join Date
    Apr 2012
    Posts
    3
    Rep Power
    0

    Default Re: converting linked list to sortedset

    ok, i have a linked list called "object" and my objective is to turn this linked list in to a sorted set from the method bellow:

    public SortedSet<Object> getObject() {
    Collections.sort(object);
    return ?????object??? ;
    }

    im trying to use Collections.sort(object); to convert it, but the problem is i dont know wat is suposed to return after doing

  5. #5
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,343
    Rep Power
    25

    Default Re: converting linked list to sortedset

    The sort() method doesn't change the object's type.
    If you don't understand my response, don't ignore it, ask a question.

  6. #6
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: converting linked list to sortedset

    Perhaps you want to create one of the types of concrete Set that allow sorting such as a TreeSet. Consider looking over the TreeSet API, especially its constructors, as it may give you some useful ideas.

Similar Threads

  1. Linked List, Array List time complexity
    By Rick99771977 in forum New To Java
    Replies: 4
    Last Post: 08-18-2011, 05:37 AM
  2. Linked List Help
    By sneeak in forum New To Java
    Replies: 8
    Last Post: 08-08-2011, 04:36 PM
  3. Replies: 4
    Last Post: 02-21-2011, 09:34 AM
  4. Linked list inside a linked list
    By viperlasson in forum New To Java
    Replies: 5
    Last Post: 07-26-2010, 11:15 PM
  5. Linked List integer list
    By igniteflow in forum Advanced Java
    Replies: 1
    Last Post: 12-10-2008, 08:53 PM

Posting Permissions

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