[ 
https://issues.apache.org/jira/browse/JENA-966?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14598364#comment-14598364
 ] 

Andy Seaborne commented on JENA-966:
------------------------------------

The contract for {{Supplier}} is not specific enough for that use.

{{Supplier::get}} can return a different object each time or not.  It may be a 
factory pattern, it may be container, it may be a delayed slot . The javadoc 
contract does not say it is not the same object each time. When the result is 
stateful, like an iterator, that matters.

For example: {{first.andThen(() -> bigThing.createIterator())}}. So I think 
that {{Supplier::get}} must be called only once to be safe.



> LazyIterator
> ------------
>
>                 Key: JENA-966
>                 URL: https://issues.apache.org/jira/browse/JENA-966
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: Jena 3.0.0
>            Reporter: Claude Warren
>            Assignee: Claude Warren
>
> LazyIterator is an abstract class.  The documentation indicates that the 
> create() method needs to be overridden to create an instance.  From this I 
> would expect that 
> now LazyIterator(){
> @Override
> public ExtendedIterator<Model> create() {
>                       ...
> }};
> Would work however LazyIterator does not override:
> remoteNext(), andThen(), toList(), and toSet().
> I believe these should be implemented in the class.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to