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

15
LINES

< > BotCompany Repo | #1020112 // paramsWithout - drop key from param array

JavaX fragment (include)

static O[] paramsWithout(O[] a1, O... keys) {
  if (l(a1) == 1 && a1[0] instanceof Map)
    ret new O[] { mapMinus((Map) a1[0], keys) };
    
  Set set = lithashset(keys);
  new L l;
  int n = l(a1);
  for (int i = 0; i < n; i += 2)
    if (i == n-1) l.add(a1[i]);
    else if (!set.contains(a1[i])) {
      l.add(a1[i]);
      l.add(a1[i+1]);
    }
  ret toObjectArray(l);
}

Author comment

Began life as a copy of #1011578

download  show line numbers  debug dex  old transpilations   

Travelled to 9 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1020112
Snippet name: paramsWithout - drop key from param array
Eternal ID of this version: #1020112/7
Text MD5: 348ddd1ef2b8e32fca61e68466661750
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-03-11 19:06:54
Source code size: 389 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 350 / 403
Version history: 6 change(s)
Referenced in: [show references]