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).

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

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

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

static L antiFilter(O pred, O[] c) {
  ret antiFilter(pred, wrapArrayAsList(c));
}

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

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

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

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

Author comment

Began life as a copy of #1003524

download  show line numbers  debug dex   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, 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: 175 / 221
Version history: 6 change(s)
Referenced in: [show references]

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