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

6
LINES

< > BotCompany Repo | #1011379 // mapPutOrRemove - synonym of mapPut2 - put into map if key & value are not null or delete key if value is null

JavaX fragment (include)

static <A, B> B mapPutOrRemove(Map<A, B> map, A key, B value) {
  if (map != null && key != null)
    if (value != null) ret map.put(key, value);
    else ret map.remove(key);
  null;
}

Author comment

Began life as a copy of #1008151

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1011379
Snippet name: mapPutOrRemove - synonym of mapPut2 - put into map if key & value are not null or delete key if value is null
Eternal ID of this version: #1011379/3
Text MD5: cfa211e00d3e212a1b9be4c9e688b0ba
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-23 18:45:49
Source code size: 190 bytes / 6 lines
Pitched / IR pitched: No / No
Views / Downloads: 453 / 615
Version history: 2 change(s)
Referenced in: [show references]