Search:

Type: Posts; User: keepStriving

Search: Search took 0.12 seconds.

  1. Replies
    6
    Views
    979

    [SOLVED] Re: Sorting with a comparator

    It works, it's not the actual source code it's just shows the template I used. getField() refers to any getter method. Object refers to the Object type the list stores.
  2. Replies
    6
    Views
    979

    [SOLVED] Re: Sorting with a comparator

    Forgive the late response, just saw your post now, I did the following:



    Collections.sort(myList,
    new Comparator<Object>()
    {
    public int...
  3. Replies
    6
    Views
    979

    [SOLVED] Re: Sorting with a comparator

    The objects hold fields, I want the arraylist to sort the objects based on a certain field.
  4. Replies
    6
    Views
    979

    [SOLVED] Sorting with a comparator

    I am trying to sort an ArrayList of objects with the comparator as I want to sort based on a certain value for each object. I understand I would need to override compareTo() in the objects class, is...
Results 1 to 4 of 4