/** * Sorts the elements of {@code array} in descending order. * * <p>Note that this method uses the total order imposed by {@link Float#compare}, which treats * all NaN values as equal and 0.0 as greater than -0.0. * * @since 23.1 */ public static void sortDescending(float[] 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 Float#compare}, which treats * all NaN values as equal and 0.0 as greater than -0.0. * * @since 23.1 */ public static void sortDescending(float[] 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 Float#compare}, which treats * all NaN values as equal and 0.0 as greater than -0.0. * * @since 23.1 */ public static void sortDescending(float[] array) { checkNotNull(array); sortDescending(array, 0, array.length); }
private static void testSortDescending(float[] input, float[] expectedOutput) { input = Arrays.copyOf(input, input.length); Floats.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, Float.compare(expectedOutput[i], input[i])); } }
private static void testSortDescending( float[] input, int fromIndex, int toIndex, float[] expectedOutput) { input = Arrays.copyOf(input, input.length); Floats.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, Float.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 Float#compare}, which treats * all NaN values as equal and 0.0 as greater than -0.0. * * @since 23.1 */ public static void sortDescending(float[] 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 Float#compare}, which treats * all NaN values as equal and 0.0 as greater than -0.0. * * @since 23.1 */ public static void sortDescending(float[] array) { checkNotNull(array); sortDescending(array, 0, array.length); }
private static void testSortDescending(float[] input, float[] expectedOutput) { input = Arrays.copyOf(input, input.length); Floats.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, Float.compare(expectedOutput[i], input[i])); } }
private static void testSortDescending( float[] input, int fromIndex, int toIndex, float[] expectedOutput) { input = Arrays.copyOf(input, input.length); Floats.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, Float.compare(expectedOutput[i], input[i])); } }