eric-milles commented on code in PR #2247:
URL: https://github.com/apache/groovy/pull/2247#discussion_r2132355571


##########
src/main/java/org/codehaus/groovy/runtime/StreamGroovyMethods.java:
##########
@@ -568,6 +568,24 @@ public static DoubleStream doubleStream(final double[] 
self) {
         return Arrays.stream(self);
     }
 
+    /**
+     * Return the size of this stream.
+     * This is a terminal operator and care should be taken
+     * with stream pipelines that have side effects or infinite streams.
+     * <pre class="groovyTestCase">
+     * assert [1, 2, 3].stream().size() == 3
+     * </pre>
+     *
+     * @param self A stream
+     * @return the count of elements in this stream
+     * @see Stream#count()
+     *
+     * @since 5.0.0
+     */
+    public static <T> long size(final Stream<T> self) {

Review Comment:
   `BaseStream` will let you size the primitive type streams as well.  And I 
agree, use `?` since the stream element type is irrelevant.



-- 
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: notifications-unsubscr...@groovy.apache.org

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

Reply via email to