You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2023/01/19 12:18:11 UTC

[GitHub] [maven] laeubi commented on a diff in pull request #913: MNG-7630 - Support listing of workspace models

laeubi commented on code in PR #913:
URL: https://github.com/apache/maven/pull/913#discussion_r1081186329


##########
maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenWorkspaceReader.java:
##########
@@ -28,4 +29,20 @@
 public interface MavenWorkspaceReader extends WorkspaceReader {
 
     Model findModel(Artifact artifact);
+
+    /**
+     * List all available artifacts this workspace repository manages.
+     *
+     * @return a stream of artifacts in no particular order
+     * @since 3.9.0
+     */
+    Stream<Artifact> listArtifacts();

Review Comment:
   [From the javadoc](https://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html):
   
   > Streams have a [BaseStream.close()](https://docs.oracle.com/javase/8/docs/api/java/util/stream/BaseStream.html#close--) method and implement [AutoCloseable](https://docs.oracle.com/javase/8/docs/api/java/lang/AutoCloseable.html), but nearly all stream instances do not actually need to be closed after use. Generally, only streams whose source is an IO channel (such as those returned by [Files.lines(Path, Charset)](https://docs.oracle.com/javase/8/docs/api/java/nio/file/Files.html#lines-java.nio.file.Path-java.nio.charset.Charset-)) will require closing. Most streams are backed by collections, arrays, or generating functions, which require no special resource management.
   
   as there is no IO involved, there is no problem and callers can convert to list if they think it is required.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org