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

13
LINES

< > BotCompany Repo | #1000734 // find - find object in collection with matching fields / find in text

JavaX fragment (include)

1  
static String find(String pattern, String text) {
2  
  Matcher matcher = Pattern.compile(pattern).matcher(text);
3  
  if (matcher.find())
4  
    return matcher.group(1);
5  
  return null;
6  
}
7  
8  
static <A> A find(Collection<A> c, O... data) {
9  
  for (A x : c)
10  
    if (checkFields(x, data))
11  
      ret x;
12  
  ret null;
13  
}

Author comment

Began life as a copy of #2000489

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1000734
Snippet name: find - find object in collection with matching fields / find in text
Eternal ID of this version: #1000734/1
Text MD5: bbfcba858ced2ca7e41a485ec46717ae
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-05-21 02:59:56
Source code size: 311 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 700 / 1912
Referenced in: [show references]