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

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

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

Merge branch 'COMMONSRDF-12-graph-iterable'

Fixes COMMONSRDF-12 by adding graph.iterate() and .iterate(s,p,o)

This closes #8.


> 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