Created
July 4, 2016 14:00
-
-
Save developer-sdk/46ffe804b08d7ef5c8d134b8e0f99630 to your computer and use it in GitHub Desktop.
Exception in thread "main" java.lang.IllegalArgumentException: Comparison method violates its general contract! 에러 수정
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
| Arrays.sort(array, new Comparator<int[]>() { | |
| @Override | |
| public int compare(int[] a, int[] b) { | |
| System.out.printf("%d %d\n", a[1], b[1]); | |
| // 에러 구문 | |
| // return (a[1] < b[1]) ? -1 : 1; | |
| // 수정 구문 | |
| return (a[1] <= b[1]) ? -1 : 1; | |
| } | |
| }); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment