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

19
LINES

< > BotCompany Repo | #1017294 - filterAntiFilter - make "true" and "false" list using predicate

JavaX fragment (include)

1  
static <A> Pair<L<A>> filterAntiFilter(Iterable<A> c, O pred) {
2  
  new L<A> yes;
3  
  new L<A> no;
4  
  if (c != null) for (A o : c)
5  
    (isTrue(callF(pred, o)) ? yes : no).add(o);
6  
  ret pair(yes, no);
7  
}
8  
9  
static <A> Pair<L<A>> filterAntiFilter(Iterable<A> c, IF1<A, Bool> pred) {
10  
  ret filterAntiFilter(c, (O) pred);
11  
}
12  
13  
static <A> Pair<L<A>> filterAntiFilter(IF1<A, Bool> pred, Iterable<A> c) {
14  
  ret filterAntiFilter(c, pred);
15  
}
16  
17  
static <A> Pair<L<A>> filterAntiFilter(O pred, Iterable<A> c) {
18  
  ret filterAntiFilter(c, pred);
19  
}

Author comment

Began life as a copy of #1017203

download  show line numbers  debug dex   

Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz

No comments. add comment

Snippet ID: #1017294
Snippet name: filterAntiFilter - make "true" and "false" list using predicate
Eternal ID of this version: #1017294/7
Text MD5: a3c45668d35ecac69937ef9c4afe45d5
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-10-05 15:49:15
Source code size: 540 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 215 / 194
Version history: 6 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1017294 & http://1017294.tinybrain.de