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

8
LINES

< > BotCompany Repo | #1009709 // paramsToMap - object array to map. also takes Map as single array element

JavaX fragment (include)

static Map paramsToMap(O... params) {
  int n = l(params);
  if (l(params) == 1 && params[0] instanceof Map) ret (Map) params[0];
  new LinkedHashMap map;
  for (int i = 0; i+1 < n; i += 2)
    mapPut(map, params[i], params[i+1]);
  ret map;
}

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: #1009709
Snippet name: paramsToMap - object array to map. also takes Map as single array element
Eternal ID of this version: #1009709/3
Text MD5: 79964802f0a8ea154eaf41cc6ed11620
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-10 23:12:09
Source code size: 250 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 576 / 610
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1020475 - listParamsToMap - list to map (key, value, key, value, ...)
#1032461 - paramsToObjectMap - paramsToMap with a slightly more useful return type
#1032650 - addParamsToMap_inPlace
#1032734 - paramsToMap_withNulls