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)

static boolean matchAny(Collection<S> patterns, S s, Matches m) {
  for (S pattern : patterns)
    if (match(pattern, s, m))
      ret true;
  ret false;
}

static boolean matchAny(Collection<S> patterns, S s) {
  ret matchAny(patterns, s, null);
}

// 2nd version

sbool matchAny(S pat, Iterable<S> l) {
  ret matchAny(pat, l, null);
}

sbool matchAny(S pat, Iterable<S> l, Matches m) {
  if (l != null)
    for (S s : l)
      if (match(pat, s, m))
        true;
  false;
}

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: 750 / 746
Version history: 2 change(s)
Referenced in: [show references]