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)

static <A> Pair<L<A>> filterAntiFilter(Iterable<A> c, O pred) {
  new L<A> yes;
  new L<A> no;
  if (c != null) for (A o : c)
    (isTrue(callF(pred, o)) ? yes : no).add(o);
  ret pair(yes, no);
}

static <A> Pair<L<A>> filterAntiFilter(Iterable<A> c, IF1<A, Bool> pred) {
  ret filterAntiFilter(c, (O) pred);
}

static <A> Pair<L<A>> filterAntiFilter(IF1<A, Bool> pred, Iterable<A> c) {
  ret filterAntiFilter(c, pred);
}

static <A> Pair<L<A>> filterAntiFilter(O pred, Iterable<A> c) {
  ret filterAntiFilter(c, pred);
}

Author comment

Began life as a copy of #1017203

download  show line numbers  debug dex  old transpilations   

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

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: 509 / 512
Version history: 6 change(s)
Referenced in: [show references]