jdk/src/share/classes/java/util/TimSort.java
changeset 9006 49dc728cdd3e
parent 7803 56bc97d69d93
child 17712 b56c69500af6
equal deleted inserted replaced
9005:a329d2b300c9 9006:49dc728cdd3e
   272             /*
   272             /*
   273              * The invariants still hold: pivot >= all in [lo, left) and
   273              * The invariants still hold: pivot >= all in [lo, left) and
   274              * pivot < all in [left, start), so pivot belongs at left.  Note
   274              * pivot < all in [left, start), so pivot belongs at left.  Note
   275              * that if there are elements equal to pivot, left points to the
   275              * that if there are elements equal to pivot, left points to the
   276              * first slot after them -- that's why this sort is stable.
   276              * first slot after them -- that's why this sort is stable.
   277              * Slide elements over to make room to make room for pivot.
   277              * Slide elements over to make room for pivot.
   278              */
   278              */
   279             int n = start - left;  // The number of elements to move
   279             int n = start - left;  // The number of elements to move
   280             // Switch is just an optimization for arraycopy in default case
   280             // Switch is just an optimization for arraycopy in default case
   281             switch (n) {
   281             switch (n) {
   282                 case 2:  a[left + 2] = a[left + 1];
   282                 case 2:  a[left + 2] = a[left + 1];