Home | History | Annotate | Download | only in primitives

Lines Matching full:double

36  * Static utility methods pertaining to {@code double} primitives, that are not
37 * already found in either {@link Double} or {@link Arrays}.
48 * {@code ((Double) value).hashCode()}.
50 * @param value a primitive {@code double} value
53 public static int hashCode(double value) {
54 return ((Double) value).hashCode();
56 // long bits = Double.doubleToLongBits(value);
61 * Compares the two specified {@code double} values. The sign of the value
62 * returned is the same as that of <code>((Double) a).{@linkplain
63 * Double#compareTo compareTo}(b)</code>. As with that method, {@code NaN} is
66 * @param a the first {@code double} to compare
67 * @param b the second {@code double} to compare
71 public static int compare(double a, double b) {
72 return Double.compare(a, b);
80 * @param array an array of {@code double} values, possibly empty
81 * @param target a primitive {@code double} value
85 public static boolean contains(double[] array, double target) {
86 for (double value : array) {
99 * @param array an array of {@code double} values, possibly empty
100 * @param target a primitive {@code double} value
104 public static int indexOf(double[] array, double target) {
110 double[] array, double target, int start, int end) {
133 public static int indexOf(double[] array, double[] target) {
157 * @param array an array of {@code double} values, possibly empty
158 * @param target a primitive {@code double} value
162 public static int lastIndexOf(double[] array, double target) {
168 double[] array, double target, int start, int end) {
179 * comparison as {@link Math#min(double, double)}.
181 * @param array a <i>nonempty</i> array of {@code double} values
186 public static double min(double... array) {
188 double min = array[0];
197 * of comparison as {@link Math#max(double, double)}.
199 * @param array a <i>nonempty</i> array of {@code double} values
204 public static double max(double... array) {
206 double max = array[0];
215 * For example, {@code concat(new double[] {a, b}, new double[] {}, new
216 * double[] {c}} returns the array {@code {a, b, c}}.
218 * @param arrays zero or more {@code double} arrays
222 public static double[] concat(double[]... arrays) {
224 for (double[] array : arrays) {
227 double[] result = new double[length];
229 for (double[] array : arrays) {
252 public static double[] ensureCapacity(
253 double[] array, int minLength, int padding) {
262 private static double[] copyOf(double[] original, int length) {
263 double[] copy = new double[length];
269 * Returns a string containing the supplied {@code double} values, converted
270 * to strings as specified by {@link Double#toString(double)}, and separated
276 * @param array an array of {@code double} values, possibly empty
278 public static String join(String separator, double... array) {
294 * Returns a comparator that compares two {@code double} arrays
296 * #compare(double, double)}), the first pair of values that follow any
303 * it is consistent with {@link Arrays#equals(double[], double[])}.
309 public static Comparator<double[]> lexicographicalComparator() {
313 private enum LexicographicalComparator implements Comparator<double[]> {
316 public int compare(double[] left, double[] right) {
329 * Copies a collection of {@code Double} instances into a new array of
330 * primitive {@code double} values.
336 * @param collection a collection of {@code Double} objects
342 public static double[] toArray(Collection<Double> collection) {
349 double[] array = new double[len];
351 array[i] = (Double) boxedArray[i];
363 * {@code Double} objects written to or read from it. For example, whether
373 public static List<Double> asList(double... backingArray) {
381 private static class DoubleArrayAsList extends AbstractList<Double>
383 final double[] array;
387 DoubleArrayAsList(double[] array) {
391 DoubleArrayAsList(double[] array, int start, int end) {
405 @Override public Double get(int index) {
412 return (target instanceof Double)
413 && Doubles.indexOf(array, (Double) target, start, end) != -1;
418 if (target instanceof Double) {
419 int i = Doubles.indexOf(array, (Double) target, start, end);
429 if (target instanceof Double) {
430 int i = Doubles.lastIndexOf(array, (Double) target, start, end);
438 @Override public Double set(int index, Double element) {
440 double oldValue = array[start + index];
446 /*@Override*/ public List<Double> subList(int fromIndex, int toIndex) {
492 double[] toDoubleArray() {
495 double[] result = new double[size];