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

          Activity

          Show
          micstriit Michael Offner added a comment - https://github.com/getrailo/railo/commit/c5e7281136f227bf9bee3e1dec11df66172f1a23
          Hide
          webRat Todd Rafferty added a comment -
          Show
          webRat Todd Rafferty added a comment - Recently discussed on the mailing list: http://groups.google.com/group/railo/browse_thread/thread/ff4f12d124bb19ee

            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:

                Development