Libraryless. Click here for Pure Java version (30L/1K).
1 | static <A, B> Map<A, B> putOrCreate(Map<A, B> map, A key, B value) { |
2 | if (map == null) map = new HashMap; |
3 | map.put(key, value); |
4 | ret map; |
5 | } |
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: | 182 / 258 |
Referenced in: | [show references] |