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

shuffled modifies input array

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.0, 4.0.0, 5.x
    • 3.0.21, 4.0.19, 5.0.0-alpha-6
    • groovy-jdk
    • None

    Description

      Integer[] array = [10, 5, 20]
      def result = array.shuffled()
      assert array !== result
      assert array.size() == result.size()
      assert array.every{ result.contains(it) }
      assert array == new Integer[] {10, 5, 20} // fails!
      

      Attachments

        Activity

          People

            emilles Eric Milles
            emilles Eric Milles
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: