private List<AnnotationSuggestion> getMatchingSuggestion(List<SuggestionGroup> aSuggestions, String aDocumentName, long aLayerId, String aFeature, int aBegin, int aEnd, String aLabel) { return aSuggestions.stream() .filter(group -> aDocumentName.equals(group.getDocumentName()) && aLayerId == group.getLayerId() && (aFeature == null || aFeature == group.getFeature()) && (aBegin == -1 || aBegin == group.getOffset().getBegin()) && (aEnd == -1 || aEnd == group.getOffset().getEnd())) .flatMap(group -> group.stream()) .filter(suggestion -> aLabel == null || aLabel.equals(suggestion.getLabel())) .collect(toList()); }
private List<AnnotationSuggestion> getMatchingSuggestion(List<SuggestionGroup> aSuggestions, String aDocumentName, long aLayerId, String aFeature, int aBegin, int aEnd, String aLabel) { return aSuggestions.stream() .filter(group -> aDocumentName.equals(group.getDocumentName()) && aLayerId == group.getLayerId() && (aFeature == null || aFeature == group.getFeature()) && (aBegin == -1 || aBegin == group.getOffset().getBegin()) && (aEnd == -1 || aEnd == group.getOffset().getEnd())) .flatMap(group -> group.stream()) .filter(suggestion -> aLabel == null || aLabel.equals(suggestion.getLabel())) .collect(toList()); }
comparingInt(Offset::getBegin).thenComparingInt(Offset::getEnd)); suggestionsInWindow.stream() .filter(group -> group.getFeature().equals(feature.getName())) .forEach(group -> suggestions.put(group.getOffset(), group));