Created
November 9, 2011 12:57
-
-
Save seratch/1351345 to your computer and use it in GitHub Desktop.
Example2.java #daimonscala 21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.Arrays; | |
| import java.util.Comparator; | |
| public class Example2 { | |
| public static void main(String[] args) { | |
| Integer[] arr = new Integer[]{1, 5, 3, 2, 4}; | |
| Arrays.sort(arr, new Comparator<Integer>() { | |
| @Override | |
| public int compare(Integer o1, Integer o2) { | |
| return o1 - o2; | |
| } | |
| }); | |
| for (Integer i : arr) { | |
| System.out.println(i); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment