Created
March 31, 2018 05:12
-
-
Save nobeans/c52a669a7eacf680b43f93af5b491479 to your computer and use it in GitHub Desktop.
intがoverflowする時にソート順序が入れ替わる
This file contains 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
int i = 2147483647 | |
def l = [a:i-1, b:i, c:i+1] | |
assert l == [a:2147483646, b:2147483647, c:-2147483648] | |
assert l.sort { it.value }*.key == ['c', 'a', 'b'] | |
assert l.collectEntries { [it.key, "lock-" + it.value] }.sort { it.value }*.key == ['c', 'a', 'b'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment