-
-
Save yermilov/a8b968c30f7ea0211a3dd10c288494d3 to your computer and use it in GitHub Desktop.
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
class TiebreakerKey28 { | |
int value | |
int hashCode() { | |
28 | |
} | |
boolean equals(o) { | |
if (this.is(o)) return true | |
if (getClass() != o.class) return false | |
TiebreakerKey28 key = (TiebreakerKey28) o | |
if (value != key.value) return false | |
return true | |
} | |
} | |
class TiebreakerComparableKey28 implements Comparable<TiebreakerComparableKey28> { | |
int value | |
int hashCode() { | |
28 | |
} | |
boolean equals(o) { | |
if (this.is(o)) return true | |
if (getClass() != o.class) return false | |
TiebreakerComparableKey28 key = (TiebreakerComparableKey28) o | |
if (value != key.value) return false | |
return true | |
} | |
@Override | |
int compareTo(TiebreakerComparableKey28 other) { | |
this.value <=> other.value | |
} | |
} | |
HashMap hashMap = new HashMap<>() | |
(1..6).each { | |
hashMap.put(new TiebreakerKey28(value: it), "hello for the $it time") | |
} | |
(7..12).each { | |
hashMap.put(new TiebreakerComparableKey28(value: it), "hello for the $it time") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment