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)

static <A> L<A> filter_pcall(Iterable<A> c, O pred) {
  if (pred instanceof F1) ret filter_pcall(c, (F1<A, Bool>) pred);

  new L x;
  if (c != null) for (O o : c)
    if (isTrue(pcallF(pred, o)))
      x.add(o);
  ret x;
}

static L filter_pcall(O pred, Iterable c) {
  ret filter_pcall(c, pred);
}

static <A, B extends A> L filter_pcall(Iterable<B> c, F1<A, Bool> pred) {
  new L x;
  if (c != null) for (B o : c) pcall {
    if (pred.get(o).booleanValue())
      x.add(o);
  }
  ret x;
}

static <A, B extends A> L filter_pcall(F1<A, Bool> pred, Iterable<B> c) {
  ret filter_pcall(c, pred);
}

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: 336 / 353
Referenced in: [show references]