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)

1  
static Collection<WebNode> ai_withoutInvalidNodes(Collection<WebNode> l) {
2  
  if (l == null) null;
3  
  for (WebNode n : l)
4  
    if (ai_isInvalidWeb(n.web)) {
5  
      Iterator<WebNode> it = iterator(l);
6  
      WebNode node;
7  
      new L<WebNode> x;
8  
      while ((node = it.next()) != n)
9  
        x.add(node);
10  
      while (it.hasNext()) {
11  
        node = it.next();
12  
        if (!ai_isInvalidWeb(node.web))
13  
          x.add(node);
14  
      }
15  
      ret x;
16  
    }
17  
  ret l;
18  
}
19  
20  
static L<WebNode> ai_withoutInvalidNodes(L<WebNode> l) {
21  
  ret (L) ai_withoutInvalidNodes((Collection) l);
22  
}

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: 520 / 538
Version history: 5 change(s)
Referenced in: [show references]