Is optional.get() == null an expected or acceptable solution? I supose it might be in this case. However i am beginning to believe that streaming operations should not be applied to iterators and rather that methods to convert the iterator to a stream should be sufficient. And i believe that has been implemented.
Claude On 6 Dec 2017 15:38, "Andy Seaborne (JIRA)" <j...@apache.org> wrote: > > [ https://issues.apache.org/jira/browse/JENA-1427?page= > com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] > > Andy Seaborne resolved JENA-1427. > --------------------------------- > Resolution: Done > Assignee: Andy Seaborne > Fix Version/s: Jena 3.6.0 > > > Add nextOrElse() method in ExtendedIterator > > ------------------------------------------- > > > > Key: JENA-1427 > > URL: https://issues.apache.org/jira/browse/JENA-1427 > > Project: Apache Jena > > Issue Type: Improvement > > Components: Core > > Affects Versions: Jena 3.5.0 > > Reporter: Adam Jacobs > > Assignee: Andy Seaborne > > Priority: Trivial > > Labels: easytask > > Fix For: Jena 3.6.0 > > > > > > Allow a functional approach for returning a default value or throwing a > custom exception from a Jena iterator. > > The following method may be added to the ExtendedIterator interface. > > {noformat} > > /** > > Answer the next object, if it exists, otherwise invoke the > _supplier_. > > */ > > public default T nextOrElse( Supplier<T> supplier ) { > > return hasNext() ? next() : supplier.get(); > > } > > {noformat} > > > > -- > This message was sent by Atlassian JIRA > (v6.4.14#64029) >