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

8
LINES

< > BotCompany Repo | #1006220 // makeComparator - convert two-argument func to Comparator; also takes a Comparator

JavaX fragment (include)

1  
static Comparator makeComparator(fO f) {
2  
  if (f instanceof Comparator) ret (Comparator) f;
3  
  ret new Comparator {
4  
    public int compare(O a, O b) {
5  
      ret (Int) callF(f, a, b);
6  
    }
7  
  };
8  
}

Author comment

Began life as a copy of #1003400

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1006220
Snippet name: makeComparator - convert two-argument func to Comparator; also takes a Comparator
Eternal ID of this version: #1006220/4
Text MD5: 85c41d65d4d28baa0cf1be63d9bf61a7
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-04 14:09:42
Source code size: 203 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 554 / 596
Version history: 3 change(s)
Referenced in: [show references]