Libraryless. Click here for Pure Java version (2806L/16K).
1 | static int syncL(Cl l) { |
2 | if (l == null) ret 0; |
3 | synchronized(collectionMutex(l)) { ret l.size(); } |
4 | } |
5 | |
6 | static int syncL(Map map) { |
7 | if (map == null) ret 0; |
8 | synchronized(collectionMutex(map)) { ret map.size(); } |
9 | } |
10 | |
11 | static <A> L<A> syncL() { |
12 | ret syncList(); |
13 | } |
Began life as a copy of #1012674
download show line numbers debug dex old transpilations
Travelled to 9 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1020733 |
Snippet name: | syncL - get size of collection or map while synchronizing on it. also, make a synchronized ArrayList |
Eternal ID of this version: | #1020733/7 |
Text MD5: | 6bacc04bbda0fd1f580239b4432894c3 |
Transpilation MD5: | c25997e68799de06492e34d9b1cc1fea |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-06-17 07:24:04 |
Source code size: | 276 bytes / 13 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 323 / 442 |
Version history: | 6 change(s) |
Referenced in: | [show references] |