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

7
LINES

< > BotCompany Repo | #1014218 // putUnlessZero - put into map if int/double value != 0

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

Libraryless. Click here for Pure Java version (32L/1K).

static <A> void putUnlessZero(Map<A, Int> map, A key, int value) {
  if (map != null && key != null && value != 0) map.put(key, value);
}

static <A> void putUnlessZero(Map<A, Double> map, A key, double value) {
  if (map != null && key != null && value != 0) map.put(key, value);
}

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: #1014218
Snippet name: putUnlessZero - put into map if int/double value != 0
Eternal ID of this version: #1014218/3
Text MD5: 9520771d30424cca1bdcd7d37fd81e5e
Transpilation MD5: a2f6ba1e34f3f4165a304f6d25b1fd00
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-11-05 10:52:30
Source code size: 288 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 307 / 371
Version history: 2 change(s)
Referenced in: [show references]