Libraryless. Click here for Pure Java version (2811L/16K).
1 | static <A> A vm_generalMap_getOrCreate(O key, F0<A> create) { |
2 | ret vm_generalMap_getOrCreate(key, f0ToIF0(create)); |
3 | } |
4 | |
5 | static <A> A vm_generalMap_getOrCreate(O key, IF0<A> create) { |
6 | Map generalMap = vm_generalMap(); |
7 | if (generalMap == null) null; // must be x30 init |
8 | |
9 | synchronized(generalMap) { // should switch to locks here |
10 | A a = cast vm_generalMap_get(key); |
11 | if (a == null) |
12 | vm_generalMap_put(key, a = create?!); |
13 | ret a; |
14 | } |
15 | } |
Began life as a copy of #1019071
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ekrmjmnbrukm, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1019072 |
Snippet name: | vm_generalMap_getOrCreate |
Eternal ID of this version: | #1019072/8 |
Text MD5: | d21092e6b887fd99a2c1588616dfb90a |
Transpilation MD5: | 530ba237636aea3b448e100c2277c88b |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-06-12 00:38:29 |
Source code size: | 468 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 384 / 498 |
Version history: | 7 change(s) |
Referenced in: | [show references] |