XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.1.0
    • None
    • None

    Description

      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:

              for (Triple t : graph) {
                  System.out.println(t);
              }
      

      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?

      Attachments

        Activity

          People

            stain Stian Soiland-Reyes
            stain Stian Soiland-Reyes
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: