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

6
LINES

< > BotCompany Repo | #1031660 // asTreeMapWithDefaultComparator

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

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

static <A, B> TreeMap<A, B> asTreeMapWithDefaultComparator(Map<A, B> map) {
  if (map cast TreeMap)
    if (map.comparator() == null)
      ret map;
  ret map == null ? new TreeMap : new TreeMap(map);
}

Author comment

Began life as a copy of #1005222

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031660
Snippet name: asTreeMapWithDefaultComparator
Eternal ID of this version: #1031660/2
Text MD5: e96ec524c62e280aa240ec3e98fc687e
Transpilation MD5: 435a7969c258f013f95e525ad1748533
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-25 07:24:17
Source code size: 207 bytes / 6 lines
Pitched / IR pitched: No / No
Views / Downloads: 65 / 109
Version history: 1 change(s)
Referenced in: [show references]