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

31
LINES

< > BotCompany Repo | #1021427 // any - check if predicate matches on any element of collection

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

Libraryless. Click here for Pure Java version (5026L/28K).

static <A> bool any(O pred, Iterable<A> l) {
  if (l != null) for (A a : l)
    if (isTrue(callF(pred, a)))
      true;
  false;
}

static <A> bool lambdaMapLike any(IF1<A, Bool> pred, Iterable<A> l) {
  if (l != null) for (A a : l)
    if (pred.get(a))
      true;
  false;
}

static <A> bool any(Iterable<A> l, IF1<A, Bool> pred) {
  ret any(pred, l);
}

static <A> bool any(A[] l, IF1<A, Bool> pred) {
  if (l != null) for (A a : l)
    if (pred.get(a))
      true;
  false;
}

sbool any(Iterable<Bool> l) {
  if (l != null) for (Bool a : l)
    if (isTrue(a))
      true;
  false;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1021427
Snippet name: any - check if predicate matches on any element of collection
Eternal ID of this version: #1021427/16
Text MD5: 10ef16887772d6564027a361e18ec7d5
Transpilation MD5: 7090cb57cc833050abbaabd7d8571dda
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-02-10 02:34:13
Source code size: 616 bytes / 31 lines
Pitched / IR pitched: No / No
Views / Downloads: 319 / 452
Version history: 15 change(s)
Referenced in: [show references]