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

5
LINES

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

JavaX fragment (include)

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

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: #1008151
Snippet name: mapPut2 - put into map if key & value are not null or delete key if value is null
Eternal ID of this version: #1008151/1
Text MD5: f45118df2cb6cad5a2c0760473304a56
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-04-28 13:37:02
Source code size: 169 bytes / 5 lines
Pitched / IR pitched: No / No
Views / Downloads: 472 / 506
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1011379 - mapPutOrRemove - synonym of mapPut2 - put into map if key & value are not null or delete key if value is null
#1024463 - mapPut2_createLinkedHashMap