[
https://issues.apache.org/jira/browse/JENA-1427?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16257432#comment-16257432
]
A. Soroka commented on JENA-1427:
---------------------------------
That's true (and the thing I want most from Java is that it should be Scala! :)
), but it's important not to let syntax override semantics. We're already
talking on the dev@ list (thanks in part to your question about immutability!)
about a potential new API. It might be better to put this effort into that
work. As [~andy.seaborne] points out above, it's a lot harder to add to an API
that has been out in the wild for as long as Jena's has than to start from a
clean field.
> 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
> Priority: Trivial
> Labels: easytask
>
> 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)