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

13
LINES

< > BotCompany Repo | #1024891 // sortedByMapElementDesc

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (68L/1K).

static L<Map> sortedByMapElementDesc(Collection<Map> c, fO key) {
  L<Map> l = new ArrayList(c);
  sort(l, new Comparator<Map>() {
    public int compare(Map a, Map b) {
      ret cmp(b.get(key), a.get(key));
    }
  });
  ret l;
}

static L<Map> mapMethodLike sortedByMapElementDesc(fO key, Collection<Map> c) {
  ret sortedByMapElementDesc(c, key);
}

Author comment

Began life as a copy of #1010437

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1024891
Snippet name: sortedByMapElementDesc
Eternal ID of this version: #1024891/3
Text MD5: ab4973d677e91577e3a5d367d01d3232
Transpilation MD5: b93c40b25e892686a6dca18ff8ac0e55
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-28 22:34:37
Source code size: 364 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 129 / 190
Version history: 2 change(s)
Referenced in: [show references]