Libraryless. Click here for Pure Java version (2142L/14K).
static <A, B> B getOrCreate_allowNull(Map<A, B> map, A key, IF0<B> f) ctex { synchronized(map) { // avoid race condition if (map.containsKey(key)) ret map.get(key); } B b = f!; map.put(key, b); ret b; }
Began life as a copy of #1013935
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1025566 |
| Snippet name: | getOrCreate_allowNull - map lookup or create from function, also cache null values |
| Eternal ID of this version: | #1025566/3 |
| Text MD5: | 6e572bc5f2414045975c432752b749de |
| Transpilation MD5: | bacde9d7ff93763ea0719dc38168bf17 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-10-03 17:36:22 |
| Source code size: | 223 bytes / 8 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 434 / 569 |
| Version history: | 2 change(s) |
| Referenced in: | [show references] |