Libraryless. Click here for Pure Java version (1756L/11K).
1 | static <A, B> B getOrCreate_f1(Map<A, B> map, A key, F1<A, B> create) {
|
2 | B b = map.get(key); |
3 | if (b == null) |
4 | mapPut(map, key, b = callF(create, key)); |
5 | ret b; |
6 | } |
7 | |
8 | static <A, B> B getOrCreate_f1(Map<A, B> map, A key, IF1<A, B> create) {
|
9 | B b = map.get(key); |
10 | if (b == null) |
11 | mapPut(map, key, b = callF(create, key)); |
12 | ret b; |
13 | } |
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: | 489 / 617 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |