static Map similarEmptyMap(Map m) { if (m instanceof TreeMap) ret new TreeMap(((TreeMap) m).comparator()); if (m instanceof LinkedHashMap) ret new LinkedHashMap; // default to a hash map ret new HashMap; } static Map similarEmptyMap(Iterable m) { if (m instanceof TreeSet) ret new TreeMap(((TreeSet) m).comparator()); if (m instanceof LinkedHashSet) ret new LinkedHashMap; ret new HashMap; }
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: | 604 / 647 |
Version history: | 3 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1007943 - similarEmptySet - make an effort to create an empty set of same type #1020214 - similarEmptyMultiMap - make an effort to create an empty MultiMap of same type |