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

1  
static <A> bool any(O pred, Iterable<A> l) {
2  
  if (l != null) for (A a : l)
3  
    if (isTrue(callF(pred, a)))
4  
      true;
5  
  false;
6  
}
7  
8  
static <A> bool lambdaMapLike any(IF1<A, Bool> pred, Iterable<A> l) {
9  
  if (l != null) for (A a : l)
10  
    if (pred.get(a))
11  
      true;
12  
  false;
13  
}
14  
15  
static <A> bool any(Iterable<A> l, IF1<A, Bool> pred) {
16  
  ret any(pred, l);
17  
}
18  
19  
static <A> bool any(A[] l, IF1<A, Bool> pred) {
20  
  if (l != null) for (A a : l)
21  
    if (pred.get(a))
22  
      true;
23  
  false;
24  
}
25  
26  
sbool any(Iterable<Bool> l) {
27  
  if (l != null) for (Bool a : l)
28  
    if (isTrue(a))
29  
      true;
30  
  false;
31  
}

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: 318 / 452
Version history: 15 change(s)
Referenced in: [show references]