Uploaded image for project: 'Railo'
  1. Railo
  2. RAILO-1291

Collection.shuffle does not work properly with arrays

    Details

      Description

      the static method java.util.Collection.shuffle(List) does not work properly with Railo Arrays (railo.runtime.type.ArrayImpl), when in the array are less than 5 objects.

      Testcase:
      <cfset arrTest = ArrayNew(1)>

      <cfset arrTest[1] = 15789>
      <cfset arrTest[2] = 15787>
      <cfset arrTest[3] = 15786>

      <cf_valueEquals left="#listSort(arrayToList(arrTest),"numeric")#" right="15786,15787,15789">
      <cfset CreateObject("java","java.util.Collections").Shuffle(arrTest) />
      <cfset CreateObject("java","java.util.Collections").Shuffle(arrTest) />
      <cfset CreateObject("java","java.util.Collections").Shuffle(arrTest) />
      <cfset CreateObject("java","java.util.Collections").Shuffle(arrTest) />
      <cfset CreateObject("java","java.util.Collections").Shuffle(arrTest) />
      <cfset CreateObject("java","java.util.Collections").Shuffle(arrTest) />
      <cfset CreateObject("java","java.util.Collections").Shuffle(arrTest) />
      <cfset CreateObject("java","java.util.Collections").Shuffle(arrTest) />
      <cfset CreateObject("java","java.util.Collections").Shuffle(arrTest) />
      <cf_valueEquals left="#listSort(arrayToList(arrTest),"numeric")#" right="15786,15787,15789">

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                micstriit Michael Offner
                Reporter:
                micstriit Michael Offner
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: