Libraryless. Click here for Pure Java version (3293L/19K).
static <A, B> Map<A, B> toMinimalMap(Map<A, B> map) { if (empty(map)) null; if (map instanceof OneMap || map instanceof MinimalMap) ret map; if (l(map) == 1) ret new OneMap(map); ret new MinimalMap(map); }
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1031047 |
Snippet name: | toMinimalMap - uses OneMap if possible |
Eternal ID of this version: | #1031047/1 |
Text MD5: | 6f141d21b11843eba1ba1b4d379e45e2 |
Transpilation MD5: | 944d60927993eecdd3d09048be0bd2cf |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-04-25 23:02:17 |
Source code size: | 218 bytes / 6 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 138 / 195 |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1031060 - toSortedArrayBasedMap |