[
https://issues.apache.org/jira/browse/JENA-1427?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16272510#comment-16272510
]
ASF GitHub Bot commented on JENA-1427:
--------------------------------------
GitHub user afs opened a pull request:
https://github.com/apache/jena/pull/323
JENA-1427: ExtendedIterator.nextOptional
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/afs/jena next-optional
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/jena/pull/323.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #323
----
commit 1a8e270fc48b5b5b3eefe24314fb75174723ab43
Author: Andy Seaborne <[email protected]>
Date: 2017-11-30T10:46:41Z
JENA-1427: ExtendedIterator.nextOptional
----
> 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)