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)

static Comparator makeComparator(fO f) {
  if (f instanceof Comparator) ret (Comparator) f;
  ret new Comparator {
    public int compare(O a, O b) {
      ret (Int) callF(f, a, b);
    }
  };
}

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: 555 / 596
Version history: 3 change(s)
Referenced in: #1006222 - makeReversedComparator - convert two-argument func to reversed Comparator
#1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1027812 - comparatorFromCalculatedField