java / devjava-content

55 stars 16 forks source link

Potentially confusing statement about DirectoryStream #67

Open cayhorstmann opened 8 months ago

cayhorstmann commented 8 months ago

In https://dev.java/learn/java-io/file-system/listing/, it says:

Remember: The returned DirectoryStream is a stream. If you are not using a try-with-resources statement, do not forget to close the stream in the finally block. The try-with-resources statement takes care of this for you. You can learn more about stream in the Stream section.

What does "...is a stream" mean? A java.util.stream.Stream? A java.io.InputStream or java.io.OutputStream? It is neither. Maybe the author meant "...is an AutoCloseable"?

danthe1st commented 6 months ago

I think it's supposed to refer to java.util.stream.Stream.

However, it neither implements Stream nor InputStream nor OutputStream so I assume it's just wrong/a simple mistake instead of a confusing statement.