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

6
LINES

< > BotCompany Repo | #1012146 // mapPutStrictly - return true if value can be put strictly (not overwriting anything)

JavaX fragment (include)

1  
static <A, B> bool mapPutStrictly(Map<A, B> map, A key, B value) {
2  
  if (!(map != null && key != null && value != null)) true;
3  
  B old = map.get(key);
4  
  if (old == null) { map.put(key, value); true; }
5  
  ret eq(old, value);
6  
}

Author comment

Began life as a copy of #1007227

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1012146
Snippet name: mapPutStrictly - return true if value can be put strictly (not overwriting anything)
Eternal ID of this version: #1012146/1
Text MD5: dcce9b530a11a2dbe3426e23cba18ca2
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-11-21 11:34:55
Source code size: 229 bytes / 6 lines
Pitched / IR pitched: No / No
Views / Downloads: 421 / 456
Referenced in: [show references]