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


##########
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:
   Streams also have the con to need collection to be cached (if you call it 
twice for ex).
   
   Streams also have the disavantage to not be reusable so if anyone call it 
and need to browse it twice it will have to materialize it too (toList()) 
making the call.
   
   So at the end from a caller perspective the collection usage is lighter in 
terms of contract and compatible with streams (`.stream()`).
   
   now if you explicit you must enforce close - which is the current PR 
contract since everything is abstracted and can be backed by a filesystem by 
contract - it is fine too, just not as convenient IMHO.
   
   Key decision point for me is: does the data fit in mem: obviously yes it is 
in maps already, so no need to stream it IMHO.



-- 
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-unsubscr...@maven.apache.org

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

Reply via email to