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

7
LINES

< > BotCompany Repo | #1007530 // mapComparator - compare by value in map

JavaX fragment (include)

static <A, B> Comparator<A> mapComparator(final Map<A, B> map) {
  ret new Comparator<A>() {
    public int compare(A a, A b) {
      ret cmp(map.get(a), map.get(b));
    }
  };
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1007530
Snippet name: mapComparator - compare by value in map
Eternal ID of this version: #1007530/5
Text MD5: 4df33075a9ddd42d2b8ab1182b8eda8a
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-03-26 11:58:56
Source code size: 185 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 618 / 658
Version history: 4 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1007532 - mapComparatorDesc - compare by value in map (reversed)