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

9
LINES

< > BotCompany Repo | #1021847 // sortByMapKey

JavaX fragment (include)

static <B, C, A extends Map<B, C>> L<A> sortByMapKey(Iterable<A> c, B key) {
  L<A> l = cloneList(c);
  sort(l, new Comparator<A>() {
    public int compare(A a, A b) {
      ret stdcompare(mapGet(a, key), mapGet(b, key));
    }
  });
  ret l;
}

Author comment

Began life as a copy of #1006712

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1021847
Snippet name: sortByMapKey
Eternal ID of this version: #1021847/4
Text MD5: 8eb74aead6871b125f306080926802df
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-09-21 12:17:05
Source code size: 253 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 275 / 318
Version history: 3 change(s)
Referenced in: [show references]