Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8273125

AutoClosableIterator interface implement Iterator and AutoClosable

XMLWordPrintable

      A DESCRIPTION OF THE PROBLEM :
      java.util.AutoClosableIterator: An interface that implement Iterator and AutoClosable. It is automatically closed by a for-each loop in the case of break, return, exception, and completion (and any other scenario in which the loop exits that I have not thought of).

      Of course it would be closed by a try-with-resources block as well since it implements AutoClosable.

      This feature would make possible, iterators which use non heap resources like files or threads.


            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: