Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4504819

Examples confuse rotation order of Collections.rotate()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.4.0
    • 1.4.0
    • docs
    • beta3
    • generic
    • generic



      Name: nt126004 Date: 09/19/2001


      java version "1.4.0-beta2"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta2-b77)
      Java HotSpot(TM) Client VM (build 1.4.0-beta2-b77, mixed mode)

      The first example in the docs:
      Before: [t, a, n, k, s]
      Operation: Collections.rotate(list, -1)
      After: [s, t, a, n, k]

      The docs say the direction goes the other way (i - distance) and the other
      example in the javadoc also says it goes the other way and it currently
      actually works that way too (I tested this out in BeanShell), but this example
      shows the oposite result. The result should be [a, n, k, s, t].

      see:
      http://java.sun.com/j2se/1.4/docs/api/java/util/Collections.html#rotate(java.util.List, int)
      (Review ID: 132206)
      ======================================================================

            shommel Scott Hommel (Inactive)
            nthompsosunw Nathanael Thompson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: