groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GROOVY-7629) ObjectRange methods duplicate functionality and should not rely on size()
Date Tue, 28 Jun 2016 09:26:57 GMT

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

ASF GitHub Bot commented on GROOVY-7629:
----------------------------------------

Github user asfgit closed the pull request at:

    https://github.com/apache/groovy/pull/143


> ObjectRange methods duplicate functionality and should not rely on size()
> -------------------------------------------------------------------------
>
>                 Key: GROOVY-7629
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7629
>             Project: Groovy
>          Issue Type: Improvement
>          Components: groovy-jdk
>            Reporter: Thibault Kruse
>            Priority: Minor
>
> The methods iterator(), step(), get(), size() and subList() all step through the range,
all having their own stepping implementation, which makes the class more complex than it needs
to be.
> Also, get(), subList() and iterator() rely on method size(), which in non-numeric cases
does a brute-force iteration over all elements. This causes an unnecessary performance overhead
in several cases (even if the value of size() is cached after first computation). The overhead
may be arbitrarily large, and in cases the size() exceed MAX_INTEGER, the reliance leads to
errors.
> (Also see GROOVY-2972, GROOVY-5426).
> I suggest unifying the stepping semantics and not relying on size(). PR will follow.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message