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

13
LINES

< > BotCompany Repo | #1024661 // paramsPlus_noOverwrite - concat param arrays (keep existing values)

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

Libraryless. Click here for Pure Java version (2260L/14K).

static O[] paramsPlus_noOverwrite(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)
    mapPut_noOverwrite(map, a2[i], a2[i+1]);
  ret mapToParams(map);
}

Author comment

Began life as a copy of #1022114

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1024661
Snippet name: paramsPlus_noOverwrite - concat param arrays (keep existing values)
Eternal ID of this version: #1024661/4
Text MD5: 758d6b77a48c364537dc3e6a9602d0e6
Transpilation MD5: 54f3ae2727aea1836868177af3c7e193
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-01-14 19:40:28
Source code size: 411 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 201 / 278
Version history: 3 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1026586 - paramsPlus_noOverwriteCheck - concat param arrays (no check for overwrites)