Libraryless. Click here for Pure Java version (1756L/11K).
static <A, B> B getOrCreate_f1(Map<A, B> map, A key, F1<A, B> create) { B b = map.get(key); if (b == null) mapPut(map, key, b = callF(create, key)); ret b; } static <A, B> B getOrCreate_f1(Map<A, B> map, A key, IF1<A, B> create) { B b = map.get(key); if (b == null) mapPut(map, key, b = callF(create, key)); ret b; }
Began life as a copy of #1013935
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1021431 |
| Snippet name: | getOrCreate_f1 - map lookup or create from function on key |
| Eternal ID of this version: | #1021431/2 |
| Text MD5: | 2ae779d19677ab12356a4f96743d1169 |
| Transpilation MD5: | b1c6faff4aaab06bf87ab4d4a76db8a7 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-08-17 16:02:15 |
| Source code size: | 349 bytes / 13 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 488 / 616 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |