Libraryless. Click here for Pure Java version (2542L/16K).
1 | static final noeq record IntPair(int a, int b) implements Comparable<IntPair> { |
2 | public boolean equals(Object o) { |
3 | if (!o instanceof IntPair) false; |
4 | IntPair x = cast o; |
5 | return a == x.a && b == x.b; |
6 | } |
7 | |
8 | public int hashCode() { |
9 | int h = -672893111; |
10 | h = boostHashCombine(h, _hashCode(a)); |
11 | h = boostHashCombine(h, _hashCode(b)); |
12 | return h; |
13 | } |
14 | |
15 | public int compareTo(IntPair p) { |
16 | if (p == null) ret 1; |
17 | int pa = p.a; |
18 | if (a < pa) ret -1; |
19 | if (a > pa) ret 1; |
20 | ret Int.compare(b, p.b); |
21 | } |
22 | } |
download show line numbers debug dex old transpilations
Travelled to 9 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1028203 |
Snippet name: | IntPair |
Eternal ID of this version: | #1028203/7 |
Text MD5: | f647257bbcbf703141d2a8b9b6299e86 |
Transpilation MD5: | f1b0e76e979d2554d86eab11e4e78242 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-05-28 14:24:35 |
Source code size: | 555 bytes / 22 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 276 / 659 |
Version history: | 6 change(s) |
Referenced in: | [show references] |