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).

1  
static O[] paramsPlus_noOverwrite(O[] a1, O... a2) {  
2  
  if (a2 == null) ret a1;
3  
  if (a1 == null) ret a2;
4  
  if (l(a1) == 1 && a1[0] instanceof Map)
5  
    ret new O[] { mapPlus((Map) a1[0], a2) };
6  
  assertEvenLength(a1);
7  
  assertEvenLength(a2);
8  
  Map map = paramsToOrderedMap(a1);
9  
  int n = l(a2);
10  
  for (int i = 0; i < n; i += 2)
11  
    mapPut_noOverwrite(map, a2[i], a2[i+1]);
12  
  ret mapToParams(map);
13  
}

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: 202 / 279
Version history: 3 change(s)
Referenced in: [show references]