Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

22
LINES

< > BotCompany Repo | #1028203 // IntPair

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2542L/16K).

static final noeq record IntPair(int a, int b) implements Comparable<IntPair> {
  public boolean equals(Object o) {
    if (!o instanceof IntPair) false;
    IntPair x = cast o;
    return a == x.a && b == x.b;
  }

  public int hashCode() {
    int h = -672893111;
    h = boostHashCombine(h, _hashCode(a));
    h = boostHashCombine(h, _hashCode(b));
    return h;
  }
  
  public int compareTo(IntPair p) {
    if (p == null) ret 1;
    int pa = p.a;
    if (a < pa) ret -1;
    if (a > pa) ret 1;
    ret Int.compare(b, p.b);
  }
}

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: 275 / 658
Version history: 6 change(s)
Referenced in: #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)