Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-5426

ObjectRange.iterator() is reliant on size()

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8.6
    • 2.5.0-alpha-1
    • groovy-jdk
    • None

    Description

      Currently the ObjectRange iterator is reliant on the size of the range.

      If the range is made up of BigInteger or BigDecimal, would it be possible to safely change this to call increment or decrement on a current internal value until it reaches its destination?

      The problem is exhibited by:

      assert [] == (1.0G..2147483648.0G).iterator().take( 2 ).collect()
      

      Where I would expect [1, 2]

      The problem is that size (being an int) for this range is -2147483648

      Attachments

        Activity

          People

            paulk Paul King
            tim_yates Tim Yates
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: