You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "howard zhang (JIRA)" <ji...@apache.org> on 2016/05/07 23:59:12 UTC

[jira] [Updated] (GROOVY-7834) Calling hashCode on IntRange iterates through all elements in the range.

     [ https://issues.apache.org/jira/browse/GROOVY-7834?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

howard zhang updated GROOVY-7834:
---------------------------------
    Description: 
{code}
new IntRange(0, Integer.MAX_VALUE-1).hashCode()
{code}
The above code takes a few seconds to complete.
I believe the hashCode method is not overridden and it defaults to AbstractList which iterates through all elements.  I don't think this should be the default behavior.

http://grepcode.com/file_/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/AbstractList.java/?v=source

  was:
{code}
new IntRange(0, Integer.MAX_VALUE-1).hashCode()
{code}

I believe the hashCode method is not overridden and it defaults to AbstractList which iterates through all elements.  I don't think this should be the default behavior.

http://grepcode.com/file_/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/AbstractList.java/?v=source


> Calling hashCode on IntRange iterates through all elements in the range.
> ------------------------------------------------------------------------
>
>                 Key: GROOVY-7834
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7834
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: howard zhang
>
> {code}
> new IntRange(0, Integer.MAX_VALUE-1).hashCode()
> {code}
> The above code takes a few seconds to complete.
> I believe the hashCode method is not overridden and it defaults to AbstractList which iterates through all elements.  I don't think this should be the default behavior.
> http://grepcode.com/file_/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/AbstractList.java/?v=source



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