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

15
LINES

< > BotCompany Repo | #1011578 - paramsPlus - concat param arrays (second one overrides)

JavaX fragment (include)

static O[] paramsPlus(O[] a1, O... a2) {
  if (a2 == null) ret a1;
  if (a1 == null) ret a2;
  if (l(a1) == 1 && a1[0] instanceof Map)
    ret new O[] { mapPlus((Map) a1[0], a2) };
  assertEvenLength(a1);
  assertEvenLength(a2);
  Map map = paramsToOrderedMap(a1);
  int n = l(a2);
  for (int i = 0; i < n; i += 2) {
    O key = a2[i];
    if (key != null) map.put(key, a2[i+1]);
  }
  ret mapToParams(map);
}

Author comment

Began life as a copy of #1003112

download  show line numbers  debug dex   

Travelled to 11 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz

No comments. add comment

Snippet ID: #1011578
Snippet name: paramsPlus - concat param arrays (second one overrides)
Eternal ID of this version: #1011578/11
Text MD5: 06a3708970c1c3a6aa13cdf36c2adfab
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-04-23 13:40:33
Source code size: 423 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 298 / 313
Version history: 10 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1011578 & http://1011578.tinybrain.de