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

26
LINES

< > BotCompany Repo | #1018894 // filter_pcall - default to false

JavaX fragment (include)

1  
static <A> L<A> filter_pcall(Iterable<A> c, O pred) {
2  
  if (pred instanceof F1) ret filter_pcall(c, (F1<A, Bool>) pred);
3  
4  
  new L x;
5  
  if (c != null) for (O o : c)
6  
    if (isTrue(pcallF(pred, o)))
7  
      x.add(o);
8  
  ret x;
9  
}
10  
11  
static L filter_pcall(O pred, Iterable c) {
12  
  ret filter_pcall(c, pred);
13  
}
14  
15  
static <A, B extends A> L filter_pcall(Iterable<B> c, F1<A, Bool> pred) {
16  
  new L x;
17  
  if (c != null) for (B o : c) pcall {
18  
    if (pred.get(o).booleanValue())
19  
      x.add(o);
20  
  }
21  
  ret x;
22  
}
23  
24  
static <A, B extends A> L filter_pcall(F1<A, Bool> pred, Iterable<B> c) {
25  
  ret filter_pcall(c, pred);
26  
}

Author comment

Began life as a copy of #1003524

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1018894
Snippet name: filter_pcall - default to false
Eternal ID of this version: #1018894/1
Text MD5: ec78f31188c6a037a2d9b9bbbbbb025e
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-10-15 16:14:54
Source code size: 624 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 337 / 354
Referenced in: [show references]