1 | static Map similarEmptyMap(Map m) { |
2 | if (m instanceof TreeMap) ret new TreeMap(((TreeMap) m).comparator()); |
3 | if (m instanceof LinkedHashMap) ret new LinkedHashMap; |
4 | |
5 | // default to a hash map |
6 | ret new HashMap; |
7 | } |
8 | |
9 | static Map similarEmptyMap(Iterable m) { |
10 | if (m instanceof TreeSet) ret new TreeMap(((TreeSet) m).comparator()); |
11 | if (m instanceof LinkedHashSet) ret new LinkedHashMap; |
12 | |
13 | ret new HashMap; |
14 | } |
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: | #1004367 |
Snippet name: | similarEmptyMap - make an effort to create an empty map of same type |
Eternal ID of this version: | #1004367/4 |
Text MD5: | d0cd8e88ad8ebb53485ee6939ddafdce |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-04-16 16:21:23 |
Source code size: | 425 bytes / 14 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 605 / 648 |
Version history: | 3 change(s) |
Referenced in: | [show references] |