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

11
LINES

< > BotCompany Repo | #1019637 // combineComparators

JavaX fragment (include)

1  
static <A> Comparator<A> combineComparators(final Comparator<A>... l) {
2  
  ret new Comparator<A> {
3  
    public int compare(A a, A b) {
4  
      for (Comparator<A> c : l) {
5  
        int i = c.compare(a, b);
6  
        if (i != 0) ret i;
7  
      }
8  
      ret 0;
9  
    }
10  
  };
11  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1019637
Snippet name: combineComparators
Eternal ID of this version: #1019637/3
Text MD5: e0cf19e3e4264a94a9be5c08a3f93aec
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-11-15 03:30:15
Source code size: 270 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 394 / 449
Version history: 2 change(s)
Referenced in: [show references]