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

8
LINES

< > BotCompany Repo | #1037246 // asRevTreeMap

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

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

1  
static <A, B> TreeMap<A, B> asRevTreeMap(Map<A, B> map) {
2  
  Comparator<A> comparator = reverseComparator();
3  
  if (isTreeMapWithComparator(map, comparator))
4  
    ret (TreeMap) map;
5  
  var m2 = new TreeMap(comparator);
6  
  m2.putAll(map);
7  
  ret m2;
8  
}

Author comment

Began life as a copy of #1005222

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1037246
Snippet name: asRevTreeMap
Eternal ID of this version: #1037246/4
Text MD5: 7889dbb39fd05af1cdfd62568fb51aa5
Transpilation MD5: 3cdb58bd9ce70c8dd5e7fd352c5b09dc
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2023-08-26 02:03:35
Source code size: 251 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 80 / 119
Version history: 3 change(s)
Referenced in: [show references]