daniellansun commented on code in PR #2247: URL: https://github.com/apache/groovy/pull/2247#discussion_r2129556784
########## 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: How about `public static long size(final Stream<?> self)`? -- 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