You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Adam Jacobs (JIRA)" <ji...@apache.org> on 2017/11/17 17:00:00 UTC
[jira] [Updated] (JENA-1427) Add nextOrElse() method in
ExtendedIterator
[ https://issues.apache.org/jira/browse/JENA-1427?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Adam Jacobs updated JENA-1427:
------------------------------
Description:
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}
was:
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.
{{ /**
Answer the next object, if it exists, otherwise invoke the _supplier_.
*/
public default T nextOrElse( Supplier<T> supplier ) {
return hasNext() ? next() : supplier.get();
}
}}
> 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)