About 11,300,000 results
Open links in new tab
  1. Sort an array in Java - Stack Overflow

    Jan 20, 2012 · 11 For natural order : Arrays.sort(array) For reverse Order : Arrays.sort(array, Collections.reverseOrder()); -- > It is a static method in Collections class which will further call an …

  2. java - How to sort a List/ArrayList? - Stack Overflow

    Apr 27, 2013 · I have a List of Double objects in Java. I want to sort the ArrayList in descending order. Input ArrayList:

  3. Sort a single String in Java - Stack Overflow

    Is there a native way to sort a String by its contents in java? E.g. String s = "edcba" -> "abcde"

  4. How to use Collections.sort () in Java? - Stack Overflow

    Collections.sort(recipes); return recipes; } But now, in a different method, lets call it getRecipesSort(), I want to sort the same list but numerically, comparing a variable that contains their ID. To make …

  5. How can I sort an ArrayList of Strings in Java? - Stack Overflow

    Oct 24, 2012 · Given the fact that you cannot control the inputs (i.e. string that is coming into the ArrayList is random; zebra or dragon in any order), once the ArrayListis filled with inputs, how do I …

  6. Java Array Sort descending? - Stack Overflow

    Nov 8, 2009 · The only way to sort a primitive array in descending order is, first sort the array in ascending order and then reverse the array in place. This is also true for two-dimensional primitive …

  7. How to sort an array of objects in Java? - Stack Overflow

    Let's say you have an array of books and you want to sort them on their height, which is stored as an int and accessible through the method getHeight (). Here's how you could sort the books in your array.

  8. java - How to sort List of objects by some property - Stack Overflow

    Collections.sort(list, comparator); In general, it's a good idea to implement Comparable<T> if there's a single "natural" sort order... otherwise (if you happen to want to sort in a particular order, but might …

  9. java - How do I use Comparator to define a custom sort order? - Stack ...

    Mar 9, 2011 · Here it is not sort by alphabetic order. I want to use my custom sorting order like Red car come first, then Blue, etc. For that I try to use Java Comparator and Comparable but it allows to sort …

  10. Java how to sort a Linked List? - Stack Overflow

    Jun 6, 2011 · Here is the example to sort implemented linked list in java without using any standard java libraries.