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

ASF subversion and git services commented on COMMONSRDF-12:
-----------------------------------------------------------

Commit 73dba32067f288832879722f59bf6d1c285a5f15 in incubator-commonsrdf's 
branch refs/heads/master from [~stain]
[ https://git-wip-us.apache.org/repos/asf?p=incubator-commonsrdf.git;h=73dba32 ]

COMMONSRDF-12  Graph.iterate() - don't extend Iterable


> Graph to be Iterable
> --------------------
>
>                 Key: COMMONSRDF-12
>                 URL: https://issues.apache.org/jira/browse/COMMONSRDF-12
>             Project: Apache Commons RDF
>          Issue Type: New Feature
>            Reporter: Stian Soiland-Reyes
>            Assignee: Stian Soiland-Reyes
>
> A Graph is a collection of triples, yet it does not support the Iterable 
> interface, and thus can't be used in a classic for-each loop like:
> {code}
>         for (Triple t : graph) {
>             System.out.println(t);
>         }
> {code}
> instead you are forced to use .getTriples() and either .sequential().forEach, 
> or the awkward casting with ::iterator
> http://stackoverflow.com/questions/20129762/why-does-streamt-not-implement-iterablet
> Note that Stream is not Iterable, as it can only be iterated over once.. (I 
> often find my self adding a function like iterable() to work around such 
> cases).
> My proposal is simply to add the interface Iterable and have a default 
> implementation that calls getTriples().iterator().
> It could be that there are other solutions that also work with the filtered 
> getTriples() - e.g. some kind of Collector that is iterable?



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

Reply via email to