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

9
LINES

< > BotCompany Repo | #1021847 // sortByMapKey

JavaX fragment (include)

1  
static <B, C, A extends Map<B, C>> L<A> sortByMapKey(Iterable<A> c, B key) {
2  
  L<A> l = cloneList(c);
3  
  sort(l, new Comparator<A>() {
4  
    public int compare(A a, A b) {
5  
      ret stdcompare(mapGet(a, key), mapGet(b, key));
6  
    }
7  
  });
8  
  ret l;
9  
}

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: 197 / 243
Version history: 3 change(s)
Referenced in: [show references]