Libraryless. Click here for Pure Java version (75L/1K).
static <A> bool syncSetAdd(Cl<A> c, A a) { if (c == null) false; synchronized(collectionMutex(c)) { if (c.contains(a)) false; c.add(a); true; } }
Began life as a copy of #1002300
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1035262 |
Snippet name: | syncSetAdd - synchronized add to collection if element isn't there |
Eternal ID of this version: | #1035262/1 |
Text MD5: | 4879ce9c2bdafa6ff95bc347fa5bbf86 |
Transpilation MD5: | 2ba158303aab4f16c80640b6b3ae1f23 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-04-28 14:46:49 |
Source code size: | 170 bytes / 8 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 138 / 197 |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |