Libraryless. Click here for Pure Java version (3024L/17K).
1 | static <A, B> B syncGetOrCreate(Map<A, B> map, A key, Class<? extends B> c) ctex { |
2 | synchronized(map) { ret getOrCreate(map, key, c); } |
3 | } |
4 | |
5 | // f : func -> B |
6 | static <A, B> B syncGetOrCreate(Map<A, B> map, A key, O f) { |
7 | synchronized(map) { ret getOrCreate(map, key, f); } |
8 | } |
9 | |
10 | |
11 | static <A, B> B nuLike syncGetOrCreate(Class<? extends B> c, Map<A, B> map, A key) { |
12 | ret syncGetOrCreate(map, key, c); |
13 | } |
14 | |
15 | |
16 | static <A, B> B syncGetOrCreate(Map<A, B> map, A key, IF0<B> f) { |
17 | synchronized(map) { ret getOrCreate(map, key, f); } |
18 | } |
Began life as a copy of #1013935
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, ekrmjmnbrukm, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1024130 |
Snippet name: | syncGetOrCreate - map lookup or create from class, synchronized on map |
Eternal ID of this version: | #1024130/3 |
Text MD5: | ca183bf4b9496b042bd99501431b7a34 |
Transpilation MD5: | fe677dd602cb88080e87e6c43be2176d |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-07-23 18:27:12 |
Source code size: | 539 bytes / 18 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 279 / 389 |
Version history: | 2 change(s) |
Referenced in: | [show references] |