[ https://issues.apache.org/jira/browse/UIMA-1524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15484827#comment-15484827 ]
Marshall Schor commented on UIMA-1524: -------------------------------------- We could overlay the additional capabilities of Annotation Indexes on the stream APIs, via a few extra methods, something like this: {code} int filteredTextSum = index.stream() //create a stream from an index .reverse() .boundedBy(boundingAnnotation) // like subiterator .boundsRespectTypePriorities(true) // default is false .strict(true) // default is false; same as nonOverlappingFSs(true) .mapToInt(f -> f.getEnd() - f.getBegin()) // get the length of the covered text .sum(); // add all of these</code> {code} Things like reverse() and boundedBy() are not normal stream operators, of course. > JFSIndexRepository should be enhanced with new generic methods > -------------------------------------------------------------- > > Key: UIMA-1524 > URL: https://issues.apache.org/jira/browse/UIMA-1524 > Project: UIMA > Issue Type: Improvement > Components: Core Java Framework > Affects Versions: 2.3 > Reporter: Joern Kottmann > > Existing methods should be overloaded with an additional Class argument to > specify the exact return type. This changes make down casting of returned > objects unnecessary. -- This message was sent by Atlassian JIRA (v6.3.4#6332)