@Override public List<FieldChange> remove(List<BibEntry> entriesToRemove) { Objects.requireNonNull(entriesToRemove); List<FieldChange> changes = new ArrayList<>(); for (BibEntry entry : entriesToRemove) { if (contains(entry)) { String oldContent = entry.getField(searchField).orElse(""); KeywordList wordlist = KeywordList.parse(oldContent, keywordSeparator); wordlist.remove(searchExpression); String newContent = wordlist.getAsString(keywordSeparator); entry.setField(searchField, newContent).ifPresent(changes::add); } } return changes; }
private Set<String> getFieldContentAsWords(BibEntry entry) { if (onlySplitWordsAtSeparator) { return entry .getField(searchField) .map(content -> KeywordList.parse(content, keywordSeparator).toStringList()) .orElse(Collections.emptySet()); } else { return entry.getFieldAsWords(searchField); } }