/** * Sorts the elements of {@code array} in descending order. * * <p>Note that this method uses the total order imposed by {@link Double#compare}, which treats * all NaN values as equal and 0.0 as greater than -0.0. * * @since 23.1 */ public static void sortDescending(double[] array) { checkNotNull(array); sortDescending(array, 0, array.length); }
/** * Sorts the elements of {@code array} in descending order. * * <p>Note that this method uses the total order imposed by {@link Double#compare}, which treats * all NaN values as equal and 0.0 as greater than -0.0. * * @since 23.1 */ public static void sortDescending(double[] array) { checkNotNull(array); sortDescending(array, 0, array.length); }
/** * Sorts the elements of {@code array} in descending order. * * <p>Note that this method uses the total order imposed by {@link Double#compare}, which treats * all NaN values as equal and 0.0 as greater than -0.0. * * @since 23.1 */ public static void sortDescending(double[] array) { checkNotNull(array); sortDescending(array, 0, array.length); }
private static void testSortDescending( double[] input, int fromIndex, int toIndex, double[] expectedOutput) { input = Arrays.copyOf(input, input.length); Doubles.sortDescending(input, fromIndex, toIndex); // GWT's Arrays.equals doesn't appear to handle NaN correctly, so test each element individually for (int i = 0; i < input.length; i++) { assertEquals(0, Double.compare(expectedOutput[i], input[i])); } }
private static void testSortDescending(double[] input, double[] expectedOutput) { input = Arrays.copyOf(input, input.length); Doubles.sortDescending(input); // GWT's Arrays.equals doesn't appear to handle NaN correctly, so test each element individually for (int i = 0; i < input.length; i++) { assertEquals(0, Double.compare(expectedOutput[i], input[i])); } }
/** * Sorts the elements of {@code array} in descending order. * * <p>Note that this method uses the total order imposed by {@link Double#compare}, which treats * all NaN values as equal and 0.0 as greater than -0.0. * * @since 23.1 */ public static void sortDescending(double[] array) { checkNotNull(array); sortDescending(array, 0, array.length); }
/** * Sorts the elements of {@code array} in descending order. * * <p>Note that this method uses the total order imposed by {@link Double#compare}, which treats * all NaN values as equal and 0.0 as greater than -0.0. * * @since 23.1 */ public static void sortDescending(double[] array) { checkNotNull(array); sortDescending(array, 0, array.length); }
private static void testSortDescending(double[] input, double[] expectedOutput) { input = Arrays.copyOf(input, input.length); Doubles.sortDescending(input); // GWT's Arrays.equals doesn't appear to handle NaN correctly, so test each element individually for (int i = 0; i < input.length; i++) { assertEquals(0, Double.compare(expectedOutput[i], input[i])); } }
private static void testSortDescending( double[] input, int fromIndex, int toIndex, double[] expectedOutput) { input = Arrays.copyOf(input, input.length); Doubles.sortDescending(input, fromIndex, toIndex); // GWT's Arrays.equals doesn't appear to handle NaN correctly, so test each element individually for (int i = 0; i < input.length; i++) { assertEquals(0, Double.compare(expectedOutput[i], input[i])); } }