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

43
LINES

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

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

Libraryless. Click here for Pure Java version (2168L/14K).

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 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 antiFilter(F1<A, Bool> pred, Iterable<B> c) {
  ret antiFilter(c, pred);
}

ifclass IF1
static <A, B extends A> L 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 antiFilter(IF1<A, Bool> pred, Iterable<B> c) {
  ret antiFilter(c, pred);
}
endif

Author comment

Began life as a copy of #1003524

download  show line numbers  debug dex   

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

No comments. add comment

Snippet ID: #1017203
Snippet name: antiFilter - drop where predicate matches
Eternal ID of this version: #1017203/5
Text MD5: 0d026fb417913235d031cf22cc5a9d89
Transpilation MD5: 90deb5b5a22b191ab906cc76a4bcbc5b
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-11-18 23:05:07
Source code size: 1013 bytes / 43 lines
Pitched / IR pitched: No / No
Views / Downloads: 123 / 146
Version history: 4 change(s)
Referenced in: [show references]

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