Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

13
LINES

< > BotCompany Repo | #1020733 // syncL - get size of collection or map while synchronizing on it. also, make a synchronized ArrayList

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2806L/16K).

static int syncL(Cl l) {
  if (l == null) ret 0;
  synchronized(collectionMutex(l)) { ret l.size(); }
}

static int syncL(Map map) {
  if (map == null) ret 0;
  synchronized(collectionMutex(map)) { ret map.size(); }
}

static <A> L<A> syncL() {
  ret syncList();
}

Author comment

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: 256 / 354
Version history: 6 change(s)
Referenced in: [show references]