static String find(String pattern, String text) { Matcher matcher = Pattern.compile(pattern).matcher(text); if (matcher.find()) return matcher.group(1); return null; } static A find(Collection c, O... data) { for (A x : c) if (checkFields(x, data)) ret x; ret null; }