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).

static <A, B> bool syncMapRemoveKeyAndValuePair(Map<A, B> map, A key, B value) {
  if (map == null || key == null || value == null) false;
  synchronized(collectionMutex(map)) {
    B actualValue = map.get(key);
    if (eq(actualValue, value)) {
      map.remove(key);
      true;
    }
    false;
  }
}

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: 134 / 181
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)