You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2023/01/27 02:45:00 UTC

[jira] [Comment Edited] (GROOVY-7319) Add primitive array min() and max()

    [ https://issues.apache.org/jira/browse/GROOVY-7319?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17681167#comment-17681167 ] 

Paul King edited comment on GROOVY-7319 at 1/27/23 2:44 AM:
------------------------------------------------------------

[~yukoba] I know it has been a long time but I reopened a PR partially based on yours here:
https://github.com/apache/groovy/pull/1850
Let me know if you have any feedback. It is meant as a companion to this PR:
https://github.com/apache/groovy/pull/1848
Most folks using {{min}} will get the optimised variants. If folks really need a Closure they can use minBy and maxBy or minComparing and maxComparing if they really need an Object Comparator. This avoids ambiguity issues.


was (Author: paulk):
[~yukoba] I know it has been a long time but I reopened a PR partially based on yours here:
https://github.com/apache/groovy/pull/1850
Let me know if you have any feedback.

> Add primitive array min() and max()
> -----------------------------------
>
>                 Key: GROOVY-7319
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7319
>             Project: Groovy
>          Issue Type: Improvement
>          Components: groovy-jdk
>            Reporter: Yu Kobayashi
>            Assignee: Paul King
>            Priority: Major
>
> I added a package groovy.util.function.
> This is similar to java.util.function of Java 8.
> I added IntComparator, LongComparator, ..., to this package.
> I did not use Comparator because IntComparator is faster than Comparator.
> If I use Comparator, Java will create Integer instances every time.
> The pull request is https://github.com/groovy/groovy-core/pull/616



--
This message was sent by Atlassian Jira
(v8.20.10#820010)