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

24
LINES

< > BotCompany Repo | #1002630 // matchAny - does any of a list of patterns match? / also match pattern in list

JavaX fragment (include)

1  
static boolean matchAny(Collection<S> patterns, S s, Matches m) {
2  
  for (S pattern : patterns)
3  
    if (match(pattern, s, m))
4  
      ret true;
5  
  ret false;
6  
}
7  
8  
static boolean matchAny(Collection<S> patterns, S s) {
9  
  ret matchAny(patterns, s, null);
10  
}
11  
12  
// 2nd version
13  
14  
sbool matchAny(S pat, Iterable<S> l) {
15  
  ret matchAny(pat, l, null);
16  
}
17  
18  
sbool matchAny(S pat, Iterable<S> l, Matches m) {
19  
  if (l != null)
20  
    for (S s : l)
21  
      if (match(pat, s, m))
22  
        true;
23  
  false;
24  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1002630
Snippet name: matchAny - does any of a list of patterns match? / also match pattern in list
Eternal ID of this version: #1002630/3
Text MD5: 3f5ad4e1189fe6abf71a9f3512dddf33
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-09-10 19:36:28
Source code size: 498 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 751 / 747
Version history: 2 change(s)
Referenced in: [show references]