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

11
LINES

< > BotCompany Repo | #1035349 // syncMapRemoveKeyAndValuePair

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

Libraryless. Click here for Pure Java version (98L/1K).

1  
static <A, B> bool syncMapRemoveKeyAndValuePair(Map<A, B> map, A key, B value) {
2  
  if (map == null || key == null || value == null) false;
3  
  synchronized(collectionMutex(map)) {
4  
    B actualValue = map.get(key);
5  
    if (eq(actualValue, value)) {
6  
      map.remove(key);
7  
      true;
8  
    }
9  
    false;
10  
  }
11  
}

Author comment

Began life as a copy of #1030838

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035349
Snippet name: syncMapRemoveKeyAndValuePair
Eternal ID of this version: #1035349/1
Text MD5: 67b2dbfbde75666abdbaf478643bae5d
Transpilation MD5: 538905908dd554789095641b518fa8cb
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-05-01 19:42:55
Source code size: 313 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 130 / 177
Referenced in: [show references]