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

14
LINES

< > BotCompany Repo | #1030250 // syncRemoveAllExcept

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

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

1  
// syncs on a
2  
static <A> bool syncRemoveAllExcept(Set<A> a, Collection<A> b) {
3  
  if (a == null) false;
4  
  synchronized(collectionMutex(a)) {
5  
    ret removeAllBut(a, b);
6  
  }
7  
}
8  
9  
static <A, B> bool syncRemoveAllExcept(Map<A, B> a, Collection<A> b) {
10  
  if (a == null) false;
11  
  synchronized(collectionMutex(a)) {
12  
    ret removeAllBut(a, b);
13  
  }
14  
}

Author comment

Began life as a copy of #1030249

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030250
Snippet name: syncRemoveAllExcept
Eternal ID of this version: #1030250/1
Text MD5: fe802b402bfe1f616965de0be0ca773a
Transpilation MD5: c6846aa1760e5bd8a3b49c485f1d7f24
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-11-20 16:47:28
Source code size: 353 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 169 / 249
Referenced in: [show references]