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

Add nextOrElse() method in ExtendedIterator

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Trivial
    • Resolution: Done
    • Jena 3.5.0
    • Jena 3.6.0
    • Core

    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

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

              Dates

                Created:
                Updated:
                Resolved: