String (String fileText, String... prefixes) { List<String> strings = findListWithPrefixes(fileText, prefixes); if (strings.isEmpty()) { return null; } if (strings.size() != 1) { throw new IllegalStateException("There is more than one string with given prefixes " + Arrays.toString(prefixes) + ":\n" + StringUtil.join(strings, "\n") + "\n" + "Use findListWithPrefixes() instead."); } return strings.get(0); }