Sorts an array of double values and moves with the sort a second array.

@param values the array to sort.
@param valuesToFollow the array that should be sorted following the
indexes of the first array. Can be null.
349030
public void sort( double[] values, double[] valuesToFollow ) {
        this.valuesToSortDouble = values;
        this.valuesToFollowDouble = valuesToFollow;

        number = values.length;

        monitor.beginTask("Sorting...", -1);

        monitor.worked(1);
        quicksort(0, number - 1);

        monitor.done();
    }
1360320
public boolean addArray(float... values) {
        if (end + values.length >= this.values.length) {
            this.values = grow(this.values, (this.values.length + values.length) * 2);
        }

        System.arraycopy(values, 0, this.values, end, values.length);
        end += values.length;
        return true;
    }
8442
public void setRow(int row, double[] values) {
        checkIndices(row, values.length - 1);

        values[row] = values[row];
    }
1322828
public static Object toPrimitiveBoolArray(List<?> values)
    {
        boolean[] array = new boolean[values.size()];
        int cursor = 0;
        
        for(Object o : values)
        {
            array[cursor] = (Boolean) o;
            cursor ++;
        }
        return array;
    }
987173
public void setValues(java.util.Collection<Value> values) {
        if (values == null) {
            this.values = null;
            return;
        }

        this.values = new java.util.ArrayList<Value>(values);
    }
149833
public static void sort(float[] floatArray) {
        boolean swapped = true;
        
        while(swapped) {
            swapped = false;
            
            for(int i = 0; i < (floatArray.length - 1 ); i++) {
                if(floatArray[i] > floatArray[i + 1]) {
                    TrivialSwap.swap(floatArray, i, i + 1);
                    
                    swapped = true;
                }
            }            
        }
    }
36805
public void writeSmallDoubleArray( double[] values ) {
        int byteSize = values.length * 8 + 1;
        this.addUnsignedByte( ( short ) values.length );
        doWriteDoubleArray( values, byteSize );

    }
440705
public void sort( float[] values, float[] valuesToFollow ) {
        this.valuesToSortFloat = values;
        this.valuesToFollowFloat = valuesToFollow;
        
        number = values.length;
        
        monitor.beginTask("Sorting...", -1);
        
        monitor.worked(1);
        quicksortFloat(0, number - 1);
        
        monitor.done();
    }
747382
static final void checkSplitPointsOrder(final double[] values) {
    if (values == null) {
      throw new SketchesArgumentException("Values cannot be null.");
    }
    final int lenM1 = values.length - 1;
    for (int j = 0; j < lenM1; j++) {
      if (values[j] < values[j + 1]) { continue; }
      throw new SketchesArgumentException(
          "Values must be unique, monotonically increasing and not NaN.");
    }
  }
32469
public static <T extends Extendable> List<T> sortAndGroup(final List<T> values, final Group[] groups, final Sort sort, final boolean ascending) {
        List<T> list = sort(values, sort, ascending);
        list = group(list, groups);
        return list;
    }
1210534
@SuppressWarnings("WeakerAccess")
    public static void sort(double[] key, int start, int n, double[]... values) {
        quickSort(key, values, start, start + n, 8);
        insertionSort(key, values, start, start + n, 8);
    }
1143611
public static void oddEvenSort( double arrayToBeSorted[], double[] arrayThatFollowsTheSort ) {
        for( int i = 0; i < arrayToBeSorted.length / 2; i++ ) {
            for( int j = 0; j + 1 < arrayToBeSorted.length; j += 2 )
                if (arrayToBeSorted[j] > arrayToBeSorted[j + 1]) {
                    double tmpa = arrayToBeSorted[j];
                    arrayToBeSorted[j] = arrayToBeSorted[j + 1];
                    arrayToBeSorted[j + 1] = tmpa;
                    if (arrayThatFollowsTheSort != null) {
                        double tmpb = arrayThatFollowsTheSort[j];
                        arrayThatFollowsTheSort[j] = arrayThatFollowsTheSort[j + 1];
                        arrayThatFollowsTheSort[j + 1] = tmpb;
                    }
                }
            for( int j = 1; j + 1 < arrayToBeSorted.length; j += 2 )
                if (arrayToBeSorted[j] > arrayToBeSorted[j + 1]) {
                    double tmpa = arrayToBeSorted[j];
                    arrayToBeSorted[j] = arrayToBeSorted[j + 1];
                    arrayToBeSorted[j + 1] = tmpa;
                    if (arrayThatFollowsTheSort != null) {
                        double tmpb = arrayThatFollowsTheSort[j];
                        arrayThatFollowsTheSort[j] = arrayThatFollowsTheSort[j + 1];
                        arrayThatFollowsTheSort[j + 1] = tmpb;
                    }
                }
        }
    }
1129275
public Values<V> values () {
		if (values1 == null) {
			values1 = new OrderedMapValues(this);
			values2 = new OrderedMapValues(this);
		}
		if (!values1.valid) {
			values1.reset();
			values1.valid = true;
			values2.valid = false;
			return values1;
		}
		values2.reset();
		values2.valid = true;
		values1.valid = false;
		return values2;
	}
443606
public static Object toPrimitiveIntArray(List<?> values)
    {
        int[] array = new int[values.size()];
        int cursor = 0;
        
        for(Object o : values)
        {
            array[cursor] = (Integer) o;
            cursor ++;
        }
        return array;
    }
1371881
public synchronized void sortOnProperty(final Object value, final boolean ascending, final ValueStrategy strategy) {

        final int elementCount = size();

        for (int i = 0; i < elementCount - 1; i++) {

            for (int j = i + 1; j < elementCount; j++) {

                final T entry1 = get(i);
                final T entry2 = get(j);

                final EntryValue oc1 = strategy.getValue(entry1, value);
                final EntryValue oc2 = strategy.getValue(entry2, value);

                if (oc1 != oc2) {
                    final boolean bothNotNull = oc1 != null && oc2 != null;
                    if (ascending) {
                        if (oc2 == null || bothNotNull && oc2.compareTo(oc1) < 0) {
                            // swap entries
                            set(i, entry2);
                            set(j, entry1);
                        }
                    } else {
                        if (oc1 == null || bothNotNull && oc1.compareTo(oc2) < 0) {
                            // swap entries
                            set(i, entry2);
                            set(j, entry1);
                        }
                    }
                }
            }

        }

    }
1200800
public static long[] getSortedDistinct(long[] values) {
        if (values.length == 0)
            return values;
        Arrays.sort(values);
        int shift = 0;
        int i = 0;
        while (i + shift + 1 < values.length)
            if (values[i + shift] == values[i + shift + 1])
                ++shift;
            else {
                values[i] = values[i + shift];
                ++i;
            }
        values[i] = values[i + shift];
        return Arrays.copyOf(values, i + 1);
    }
291272
function sortByFirst(valueArrays) {
  const firstValues = valueArrays[0];
  const indices = sortedIndices(firstValues);
  return valueArrays.map(function(values) {
    return indices.map(function(sortedIndex) {
      return values[sortedIndex];
    });
  });
}