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

6
LINES

< > BotCompany Repo | #1031047 // toMinimalMap - uses OneMap if possible

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

Libraryless. Click here for Pure Java version (3293L/19K).

1  
static <A, B> Map<A, B> toMinimalMap(Map<A, B> map) {
2  
  if (empty(map)) null;
3  
  if (map instanceof OneMap || map instanceof MinimalMap) ret map;
4  
  if (l(map) == 1) ret new OneMap(map);
5  
  ret new MinimalMap(map);
6  
}

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: 139 / 197
Referenced in: [show references]