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

AutoClosableIterator interface implement Iterator and AutoClosable

    XMLWordPrintable

    Details

      Description

      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.


        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: