-
Type:
Enhancement
-
Resolution: Won't Fix
-
Priority:
P4
-
None
-
Affects Version/s: 16
-
Component/s: core-libs
-
generic
-
generic
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.
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.