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

10
LINES

< > BotCompany Repo | #1031556 // syncMapGet2 - checks map for null, but not the key

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

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

1  
static <A, B> B syncMapGet2(Map<A, B> map, A a) {
2  
  if (map == null) null;
3  
  synchronized(collectionMutex(map)) {
4  
    ret map.get(a);
5  
  }
6  
}
7  
8  
static <A, B> B mapMethodLike syncMapGet2(A a, Map<A, B> map) {
9  
  ret syncMapGet2(map, a);
10  
}

Author comment

Began life as a copy of #1024466

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1031556
Snippet name: syncMapGet2 - checks map for null, but not the key
Eternal ID of this version: #1031556/1
Text MD5: ed533d029389dfd7c1f082c7bade96da
Transpilation MD5: ec5edfd155a6c0253f1998be85732ba7
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-22 00:30:54
Source code size: 242 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 192 / 260
Referenced in: [show references]