You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by GitBox <gi...@apache.org> on 2020/12/18 05:32:44 UTC

[GitHub] [groovy] paulk-asert opened a new pull request #1444: GROOVY-9865: Add some DGM methods for primitive arrays

paulk-asert opened a new pull request #1444:
URL: https://github.com/apache/groovy/pull/1444


   


----------------------------------------------------------------
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.

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



[GitHub] [groovy] eric-milles commented on pull request #1444: GROOVY-9865: Add some DGM methods for primitive arrays

Posted by GitBox <gi...@apache.org>.
eric-milles commented on pull request #1444:
URL: https://github.com/apache/groovy/pull/1444#issuecomment-748339728


   Does it make sense to implement `max(int[])` using `IntStream`'s `max` method?  Like `IntStream.of(self).max().orElseThrow(() -> new UnsupportedOperationException(...));`?  And similarly for long and double arrays?  Essentially, the `max` DGM is just shorthand for `ints.stream().max().getAsInt()`.


----------------------------------------------------------------
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.

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



[GitHub] [groovy] eric-milles edited a comment on pull request #1444: GROOVY-9865: Add some DGM methods for primitive arrays

Posted by GitBox <gi...@apache.org>.
eric-milles edited a comment on pull request #1444:
URL: https://github.com/apache/groovy/pull/1444#issuecomment-748339728


   Does it make sense to implement `max(int[])` using `IntStream`'s `max` method?  Like `IntStream.of(self).max().orElseThrow(() -> new UnsupportedOperationException(...));`?  And similarly for long and double arrays?  Essentially, the `max` DGM is just shorthand for `ints.stream().max().asInt`.


----------------------------------------------------------------
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.

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



[GitHub] [groovy] eric-milles commented on pull request #1444: GROOVY-9865: Add some DGM methods for primitive arrays

Posted by GitBox <gi...@apache.org>.
eric-milles commented on pull request #1444:
URL: https://github.com/apache/groovy/pull/1444#issuecomment-748335694


   > How about adding `stream()` too?
   
   As in `int[] arr; Arrays.stream(arr)`?  I think `org.codehaus.groovy.vmplugin.v8.PluginDefaultGroovyMethods` covers the relevant cases.


----------------------------------------------------------------
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.

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



[GitHub] [groovy] paulk-asert commented on pull request #1444: GROOVY-9865: Add some DGM methods for primitive arrays

Posted by GitBox <gi...@apache.org>.
paulk-asert commented on pull request #1444:
URL: https://github.com/apache/groovy/pull/1444#issuecomment-748462554


   I added intStream(), longStream() and doubleStream() for int[], long[] and double[] respectively and refactored quite a few places that were making copies of arrays as lists when just iterating through them was all that was needed.


----------------------------------------------------------------
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.

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



[GitHub] [groovy] asfgit closed pull request #1444: GROOVY-9865: Add some DGM methods for primitive arrays

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #1444:
URL: https://github.com/apache/groovy/pull/1444


   


----------------------------------------------------------------
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.

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



[GitHub] [groovy] eric-milles commented on pull request #1444: GROOVY-9865: Add some DGM methods for primitive arrays

Posted by GitBox <gi...@apache.org>.
eric-milles commented on pull request #1444:
URL: https://github.com/apache/groovy/pull/1444#issuecomment-748486744


   Oh, the `stream()` methods are returning `Stream` and not `IntStream` for `int[]`.  Since you are in `PluginDefaultGroovyMethods`, can you add `@since` to `orOptional`?


----------------------------------------------------------------
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.

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



[GitHub] [groovy] danielsun1106 commented on pull request #1444: GROOVY-9865: Add some DGM methods for primitive arrays

Posted by GitBox <gi...@apache.org>.
danielsun1106 commented on pull request #1444:
URL: https://github.com/apache/groovy/pull/1444#issuecomment-748411931


   > > How about adding `stream()` too?
   > 
   > As in `int[] arr; Arrays.stream(arr)`? I think `org.codehaus.groovy.vmplugin.v8.PluginDefaultGroovyMethods` covers the relevant cases.
   
   Thanks for your reminding. I forgot we had added `stream()`...


----------------------------------------------------------------
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.

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



[GitHub] [groovy] asfgit merged pull request #1444: GROOVY-9865: Add some DGM methods for primitive arrays

Posted by GitBox <gi...@apache.org>.
asfgit merged pull request #1444:
URL: https://github.com/apache/groovy/pull/1444


   


----------------------------------------------------------------
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.

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



[GitHub] [groovy] paulk-asert commented on pull request #1444: GROOVY-9865: Add some DGM methods for primitive arrays

Posted by GitBox <gi...@apache.org>.
paulk-asert commented on pull request #1444:
URL: https://github.com/apache/groovy/pull/1444#issuecomment-748398454


   Yes, boxed streams are already covered. Possibly an unboxed variant, e.g. intStream(int[]), would also be useful.
   
   As to using the stream-based max, we could certainly consider that. For small arrays the overheads of setting up the stream would be slower than the current implementation. For large streams, there might be a gain. I am inclined to leave as is and make it easy for folks to do that themselves. If we had something like `intStream()` they could choose between `nums.max()`, `nums.intStream().max().asInt`, and `nums.intStream().parallel().max().asInt` as they felt appropriate.


----------------------------------------------------------------
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.

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



[GitHub] [groovy] danielsun1106 commented on pull request #1444: GROOVY-9865: Add some DGM methods for primitive arrays

Posted by GitBox <gi...@apache.org>.
danielsun1106 commented on pull request #1444:
URL: https://github.com/apache/groovy/pull/1444#issuecomment-748098734


   +1
   
   How about  adding `stream()` too?
   


----------------------------------------------------------------
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.

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