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

19
LINES

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

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

Libraryless. Click here for Pure Java version (2872L/17K).

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);
}

static O[] paramsPlus(Map a1, O... a2) {
  ret paramsPlus(new O[] {a1}, a2);
}

Author comment

Began life as a copy of #1003112

download  show line numbers  debug dex  old transpilations   

Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, 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/12
Text MD5: 7aa1e3e444d1dcb2cad68fa0ff3be791
Transpilation MD5: 36050b0e00f227b00dc3e4ad4f6cda70
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-02-22 13:17:10
Source code size: 507 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 346 / 370
Version history: 11 change(s)
Referenced in: [show references]

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