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

41
LINES

< > BotCompany Repo | #1017203 // antiFilter - drop where predicate matches

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2524L/16K).

1  
static <A> L<A> antiFilter(Iterable<A> c, O pred) {
2  
  if (pred instanceof F1) ret antiFilter(c, (F1<A, Bool>) pred);
3  
4  
  new L x;
5  
  if (c != null) for (O o : c)
6  
    if (!isTrue(callF(pred, o)))
7  
      x.add(o);
8  
  ret x;
9  
}
10  
11  
static L lambdaMapLike antiFilter(O pred, Iterable c) {
12  
  ret antiFilter(c, pred);
13  
}
14  
15  
static L antiFilter(O pred, O[] c) {
16  
  ret antiFilter(pred, wrapArrayAsList(c));
17  
}
18  
19  
static <A, B extends A> L<B> antiFilter(Iterable<B> c, F1<A, Bool> pred) {
20  
  new L x;
21  
  if (c != null) for (B o : c)
22  
    if (!pred.get(o).booleanValue())
23  
      x.add(o);
24  
  ret x;
25  
}
26  
27  
static <A, B extends A> L<B> antiFilter(F1<A, Bool> pred, Iterable<B> c) {
28  
  ret antiFilter(c, pred);
29  
}
30  
31  
static <A, B extends A> L<B> antiFilter(Iterable<B> c, IF1<A, Bool> pred) {
32  
  new L x;
33  
  if (c != null) for (B o : c)
34  
    if (!pred.get(o).booleanValue())
35  
      x.add(o);
36  
  ret x;
37  
}
38  
39  
static <A, B extends A> L<B> antiFilter(IF1<A, Bool> pred, Iterable<B> c) {
40  
  ret antiFilter(c, pred);
41  
}

Author comment

Began life as a copy of #1003524

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1017203
Snippet name: antiFilter - drop where predicate matches
Eternal ID of this version: #1017203/7
Text MD5: 3831f40f089d9226e65ce5a87ec20a77
Transpilation MD5: f3c15e990a5e461107db8006973c32dd
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-06-13 14:02:34
Source code size: 1007 bytes / 41 lines
Pitched / IR pitched: No / No
Views / Downloads: 524 / 644
Version history: 6 change(s)
Referenced in: [show references]