Re: Jena-1427 - nextOptional()

2017-12-17 Thread Adam Jacobs
of several options solve my problem. I appreciate everyone who has contributed to the discussion. From: ajs6f <aj...@apache.org> Sent: Sunday, December 17, 2017 1:28 PM To: dev@jena.apache.org Subject: Re: Jena-1427 - nextOptional() > On Dec 17, 2017, a

Re: Jena-1427 - nextOptional()

2017-12-17 Thread ajs6f
> On Dec 17, 2017, at 2:18 PM, Claude Warren wrote: > It seems that much of the rest of the discussion is covered by adding a > method to convert the iterator to a stream (probably just a call to an > existing Java method. Just to this point alone-- this is something that

Re: Jena-1427 - nextOptional()

2017-12-17 Thread Claude Warren
>From the original request it seems the requirements were: 1. return a default value if the iterator is empty. 2. throw a custom exception if the iterator is empty. Perhaps we should add a next( T default ) method that will return the default if hasNext() returns false. This seem better than

Re: Jena-1427 - nextOptional()

2017-12-17 Thread Andy Seaborne
We seem to have drifted a bit here - the original use case wasn't about streaming as I read it. list* get used to write zero/one tests and one/many tests dealing with properties etc. And, of course, we want to avoid the anti-pattern of Optional/if-empty. Claude - thoughts on the use case? How

Re: Jena-1427 - nextOptional()

2017-12-14 Thread ajs6f
I thought the upshot of the discussion was that we are okay with this because the Model API (the only place from which we support getting ExtendedIterators) will never have a null retrieved value and we clearly warn in the method documentation that the retrieved value must not be null. If the

Re: Jena-1427 - nextOptional()

2017-12-14 Thread Claude Warren
I was expecting that with the discovery that optional throws a null pointer exception when the retrieved value is null would be enough to remove this functionality. I am concerned that once added it will be difficult to remove and that its operation is not congruent with stream based optional

Re: Jena-1427 - nextOptional()

2017-12-14 Thread Andy Seaborne
Claude, The JIRA ticket ends: [[ ASF GitHub Bot added a comment - 04/Dec/17 15:36 That was already the case in the PR and I've added text to call it out explicitly into the javadoc. githubbot ASF GitHub Bot added a comment - 04/Dec/17 15:40 Github user ajs6f commented on the issue:

Jena-1427 - nextOptional()

2017-12-14 Thread Claude Warren
Perhaps i wasn't paying close enough attention but i didn't think adding optional and other streaming methods had been agreed. In fact i thought quite the oposite. If i am wrong please forgive the noise. If i am correct shouldn't 1427 be removed from the release candidate? Claude