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)

1  
sclass PairIC {
2  
  S a;
3  
  S b;
4  
5  
  *() {}
6  
  *(S *a, S *b) {}
7  
  
8  
  public int hashCode() {
9  
    ret hashCodeFor(a) + 2*hashCodeFor(b);
10  
  }
11  
  
12  
  public bool equals(O o) {
13  
    if (o == this) true;
14  
    if (!(o instanceof PairIC)) false;
15  
    PairIC t = cast o;
16  
    ret eq(a, t.a) && eq(b, t.b);
17  
  }
18  
  
19  
  toString {
20  
    ret "<" + a + ", " + b + ">";
21  
  }
22  
}

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: 366 / 387
Version history: 2 change(s)
Referenced in: [show references]