Storage objects sort such that primaries sort first, mirrors after.
543591
@Override
    public int compareTo(Storage o) {
        return ComparisonChain.start()
                .compareTrueFirst(isConsistent(), o.isConsistent())  // Primaries *must* be consistent.
                .compareTrueFirst(_masterPrimary, o._masterPrimary)  // Master primary sorts first
                .compare(o.getPromotionId(), getPromotionId(), TimeUUIDs.ordering().nullsLast())  // Facade primary sorts first
                .compare(_uuid, o._uuid)  // Break ties in a way that's compatible with equals()
                .result();
    }
1314626
private static <T> ArrayList<T> sorted(Collection<T> cls, Comparator<? super T> c) {
    ArrayList<T> sorted = new ArrayList<>(cls);
    sorted.sort(c);
    return sorted;
  }
447553
def sort(self, by=None, reverse=False):
        
        if by is None:
            by = self.kdims
        elif not isinstance(by, list):
            by = [by]
        sorted_columns = self.interface.sort(self, by, reverse)
        return self.clone(sorted_columns)
222928
function(items) {
            var hasRelativePositioning = hasNumberProperty(items, 'relativePosition');

            if(hasRelativePositioning) {
                items.sort(function(a, b) {
                    return a.relativePosition - b.relativePosition;
                });
            }
        }
514697
private static <V> Collection<V> sorted(Iterable<V> source, Comparator<V> comparator, int size)
    {
        V[] vs = (V[]) new Object[size];
        int i = 0;
        for (V v : source)
            vs[i++] = v;
        Arrays.sort(vs, comparator);
        return Arrays.asList(vs);
    }
1059338
function sortExternal(array, customCompare) {
  var compare = wrapCompare(customCompare, sortExternal.compareObserver);
  var swap = attachObserver(defaultSwap, sortExternal.swapObserver);
  return sort(array, 0, array.length - 1, compare, swap);
}
673903
function sortByOrdinal(extensions, done) {
    const sorted = extensions.sort((a, b) => {
        if (a.ordinal || b.ordinal) {
            if (!a.ordinal) return 1;
            if (!b.ordinal) return -1;
            if (a.ordinal < b.ordinal) return -1;
            return 1;
        }
        return a.pluginId.localeCompare(b.pluginId);
    });

    if (done) {
        done(sorted);
    }

    return sorted;
}
686768
public static <T extends Comparable<? super T>> void sortReverse(List<T> list) {
		Collections.sort(list, Collections.reverseOrder());
	}
562585
public static void sortReverse(double[] keys, int[] values, int start, int end) {
    quickSortReverse(keys, values, start, end);
  }
244996
private static void topDownMergeSort(int[] src, int[] dst, int fromIndex, int toIndex, IndirectComparator comp) {
    if (toIndex - fromIndex <= MIN_LENGTH_FOR_INSERTION_SORT) {
      insertionSort(fromIndex, toIndex - fromIndex, dst, comp);
      return;
    }

    final int mid = (fromIndex + toIndex) >>> 1;
    topDownMergeSort(dst, src, fromIndex, mid, comp);
    topDownMergeSort(dst, src, mid, toIndex, comp);

    /*
     * Both splits in of src are now sorted.
     */
    if (comp.compare(src[mid - 1], src[mid]) <= 0) {
      /*
       * If the lowest element in upper slice is larger than the highest element in
       * the lower slice, simply copy over, the data is fully sorted.
       */
      System.arraycopy(src, fromIndex, dst, fromIndex, toIndex - fromIndex);
    } else {
      /*
       * Run a manual merge.
       */
      for (int i = fromIndex, j = mid, k = fromIndex; k < toIndex; k++) {
        if (j == toIndex || (i < mid && comp.compare(src[i], src[j]) <= 0)) {
          dst[k] = src[i++];
        } else {
          dst[k] = src[j++];
        }
      }
    }
  }
213654
function sort(recursive) {
         // do nothing if there is already a pending sort
         if (!this.pendingSort) {
           if (recursive === true) {
             // trigger other child container sort function (if any)
             for (var i = this.children.length, obj; i--, obj = this.children[i];) {
               if (obj instanceof me.Container) {
                 // note : this will generate one defered sorting function
                 // for each existing containe
                 obj.sort(recursive);
               }
             }
           }
           /** @ignore */


           this.pendingSort = me.utils.function.defer(function (self) {
             // sort everything in this container
             self.children.sort(self["_sort" + self.sortOn.toUpperCase()]); // clear the defer id

             self.pendingSort = null; // make sure we redraw everything

             me.game.repaint();
           }, this, this);
         }
       }
986169
def _sort(self):
        
        self.versions = OrderedDict(sorted(self.versions.items(), key=lambda v: v[0]))
135788
def prioSort(elements):
    """"""
    # Randomize the services before sorting so that equal priority
    # elements are load-balanced.
    random.shuffle(elements)

    sorted_elems = sorted(elements, key=getPriority)
    return sorted_elems
1270776
function sortObject(originalSrc, options, done) {
  var callback

  if (options === undefined) {
    // do nothing
  } else if (typeof options === "function") {
    callback = options
  } else {
    callback = done
  }

  if (callback) {
    process.nextTick(function() {
      done(work(originalSrc))
    })
    return
  }

  function work(obj) {
    try {
      // Uses module to sort all objects key names based on standard
      // string ordering.
      var deepSorted = deep_sort_object(obj)

      // Once object keys are sorted, we still need to check for arrays.
      var out = deepInspect(deepSorted)
      return out
    } catch (e) {
      console.log(e)
      throw e
    }
  }

  return work(originalSrc)
}
276365
private void sort() {
        RangeHashSorter sortMachine;
        sortMachine = new RangeHashSorter(maxRangeValues, filenames);
        sortMachine.quickSort();
        generateBucketIds();
    }
355304
def reorder(self, single_column=False):
        """"""
        if single_column:
            columns = self.sortOrder[:1]
        else:
            columns = self.sortOrder
        for ascending,column in columns[::-1]:
            # Python 2.2+ guarantees stable sort, so sort by each column in reverse 
            # order will order by the assigned columns 
            self.sorted.sort( key=column.get, reverse=(not ascending))
213752
def sort_item(iterable, number, reverse=False):
    """"""
    return sorted(iterable, key=itemgetter(number), reverse=reverse)