Libraryless. Click here for Pure Java version (30L/1K).
static <A, B> Map<A, B> putOrCreate(Map<A, B> map, A key, B value) { if (map == null) map = new HashMap; map.put(key, value); ret map; }
Began life as a copy of #1024478
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1030902 |
Snippet name: | putOrCreate - make HashMap if null. allow null keys and values |
Eternal ID of this version: | #1030902/1 |
Text MD5: | 120e401162df492df95246351d156350 |
Transpilation MD5: | 3c38e944967014df137a1a32124b990e |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-04-08 15:50:24 |
Source code size: | 146 bytes / 5 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 183 / 258 |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1035131 - putOrCreateSyncMap - make syncHashMap if null. allow null keys and values #1035501 - putOrCreateLinkedHashMap - make LinkedHashMap if null. allow null keys and values |