Page 3 of 3 First 123
  • Jump to page:
    #31
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    38
    Rep Power
    2
    Do you mean use map.remove()?

    Originally Posted by NormR
    Remove the data from the Map so it can be sorted based on the values vs the keys.
  2. #32
  3. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,699
    Rep Power
    347
    Sorry, I meant extract/copy the data to another type of collection where it can be sorted.
  4. #33
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    74
    Rep Power
    18
    Idea:

    make a new class with attributes IPAddress and numberOfOccurences. (name it for example: IPOccurrence) and add instances to an arraylist (ipaddresses)

    Then:
    Code:
    Collections.sort(ipaddresses, new Comparator<IPOccurence>() {
        public int compare(IPOccurence one, IPOccurence other) {
            return one.numberOfOccurences.compareTo(other.numberOfOccurences);
        }
    });
  6. #34
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    38
    Rep Power
    2
    I figured it out. Thanks for the help, everyone.
Page 3 of 3 First 123
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo