Libraryless. Click here for Pure Java version (75L/1K).
1 | static <A> bool syncSetAdd(Cl<A> c, A a) { |
2 | if (c == null) false; |
3 | synchronized(collectionMutex(c)) { |
4 | if (c.contains(a)) false; |
5 | c.add(a); |
6 | true; |
7 | } |
8 | } |
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: | 137 / 197 |
Referenced in: | [show references] |