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

22
LINES

< > BotCompany Repo | #1011427 // ai_withoutInvalidNodes - cool logic to avoid making an unnecessary list

JavaX fragment (include)

static Collection<WebNode> ai_withoutInvalidNodes(Collection<WebNode> l) {
  if (l == null) null;
  for (WebNode n : l)
    if (ai_isInvalidWeb(n.web)) {
      Iterator<WebNode> it = iterator(l);
      WebNode node;
      new L<WebNode> x;
      while ((node = it.next()) != n)
        x.add(node);
      while (it.hasNext()) {
        node = it.next();
        if (!ai_isInvalidWeb(node.web))
          x.add(node);
      }
      ret x;
    }
  ret l;
}

static L<WebNode> ai_withoutInvalidNodes(L<WebNode> l) {
  ret (L) ai_withoutInvalidNodes((Collection) l);
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1011427
Snippet name: ai_withoutInvalidNodes - cool logic to avoid making an unnecessary list
Eternal ID of this version: #1011427/6
Text MD5: f66dc2d28dbeb0ccefa32487c6fa6fe9
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-10-29 02:39:52
Source code size: 585 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 521 / 538
Version history: 5 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1011428 - ai_isInvalidWeb
#1011431 - web_verifiedWebsOnly
#1011456 - ai_withoutInvalidWebs
#1011549 - web_quotedNodesOnly