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

11
LINES

< > BotCompany Repo | #1005222 // asTreeMap

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

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

static <A, B> TreeMap<A, B> asTreeMap(Map<A, B> map, Comparator<A> comparator default null) {
  if (map cast TreeMap && eq(map.comparator(), comparator))
    ret map;
  var m2 = new TreeMap(comparator);
  putAll(m2, map);
  ret m2;
}

static <A, B> TreeMap<A, B> asTreeMap(Comparator<A> comparator, Map<A, B> map) {
  ret asTreeMap(map, comparator);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005222
Snippet name: asTreeMap
Eternal ID of this version: #1005222/6
Text MD5: 7d23eb2091ec1867f1992a87f0428966
Transpilation MD5: 7dbc6447b0cb3f86c13a46a0a1a3ff94
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2024-05-18 22:21:34
Source code size: 361 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 724 / 818
Version history: 5 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1012402 - asCaseInsensitiveMap - never returns null
#1031660 - asTreeMapWithDefaultComparator
#1037246 - asRevTreeMap