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

11
LINES

< > BotCompany Repo | #1001695 // litmap - skips null values

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

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

static HashMap litmap(O... x) {
  new HashMap map;
  litmap_impl(map, x);
  ret map;
}

static void litmap_impl(Map map, O... x) {
  if (x != null) for (int i = 0; i < x.length-1; i += 2)
    if (x[i+1] != null)
      map.put(x[i], x[i+1]);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 18 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gjtlkbvenryc, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney

No comments. add comment

Snippet ID: #1001695
Snippet name: litmap - skips null values
Eternal ID of this version: #1001695/5
Text MD5: eaf66cbfae3fbc408d2bc72fff994f84
Transpilation MD5: b9107871b8b0a568189cb356eff3f6f4
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-19 16:34:15
Source code size: 252 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 878 / 2874
Version history: 4 change(s)
Referenced in: [show references]