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

22
LINES

< > BotCompany Repo | #1012602 // PairIC - case-insensitive string pair - doesn't work - how to make hashCode?

JavaX fragment (include)

sclass PairIC {
  S a;
  S b;

  *() {}
  *(S *a, S *b) {}
  
  public int hashCode() {
    ret hashCodeFor(a) + 2*hashCodeFor(b);
  }
  
  public bool equals(O o) {
    if (o == this) true;
    if (!(o instanceof PairIC)) false;
    PairIC t = cast o;
    ret eq(a, t.a) && eq(b, t.b);
  }
  
  toString {
    ret "<" + a + ", " + b + ">";
  }
}

Author comment

Began life as a copy of #1004219

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1012602
Snippet name: PairIC - case-insensitive string pair - doesn't work - how to make hashCode?
Eternal ID of this version: #1012602/3
Text MD5: 1ed4965123fb7a89b14096d7ad9361d6
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-12-07 16:40:57
Source code size: 367 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 298 / 311
Version history: 2 change(s)
Referenced in: [show references]