Uploaded image for project: 'Apache Jena'
  1. Apache Jena
  2. JENA-1427

Add nextOrElse() method in ExtendedIterator

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Trivial
    • Resolution: Done
    • Affects Version/s: Jena 3.5.0
    • Fix Version/s: Jena 3.6.0
    • Component/s: Core
    • Labels:

      Description

      Allow a functional approach for returning a default value or throwing a custom exception from a Jena iterator.

      The following method may be added to the ExtendedIterator interface.

          /**
               Answer the next object, if it exists, otherwise invoke the _supplier_.
           */
          public default T nextOrElse( Supplier<T> supplier ) {
              return hasNext() ? next() : supplier.get();
          }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                andy Andy Seaborne
                Reporter:
                jaco0646 Adam Jacobs
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: