Lines Matching full:array
77 * {@code array}. Note that this always returns {@code false} when {@code
80 * @param array an array of {@code double} values, possibly empty
82 * @return {@code true} if {@code array[i] == target} for some value of {@code
85 public static boolean contains(double[] array, double target) {
86 for (double value : array) {
96 * {@code array}. Note that this always returns {@code -1} when {@code target}
99 * @param array an array of {@code double} values, possibly empty
101 * @return the least index {@code i} for which {@code array[i] == target}, or
104 public static int indexOf(double[] array, double target) {
105 return indexOf(array, target, 0, array.length);
110 double[] array, double target, int start, int end) {
112 if (array[i] == target) {
121 * target} within {@code array}, or {@code -1} if there is no such occurrence.
124 * java.util.Arrays.copyOfRange(array, i, i + target.length)} contains exactly
130 * @param array the array to search for the sequence {@code target}
131 * @param target the array to search for as a sub-sequence of {@code array}
133 public static int indexOf(double[] array, double[] target) {
134 checkNotNull(array, "array");
141 for (int i = 0; i < array.length - target.length + 1; i++) {
143 if (array[i + j] != target[j]) {
154 * {@code array}. Note that this always returns {@code -1} when {@code target}
157 * @param array an array of {@code double} values, possibly empty
159 * @return the greatest index {@code i} for which {@code array[i] == target},
162 public static int lastIndexOf(double[] array, double target) {
163 return lastIndexOf(array, target, 0, array.length);
168 double[] array, double target, int start, int end) {
170 if (array[i] == target) {
178 * Returns the least value present in {@code array}, using the same rules of
181 * @param array a <i>nonempty</i> array of {@code double} values
182 * @return the value present in {@code array} that is less than or equal to
183 * every other value in the array
184 * @throws IllegalArgumentException if {@code array} is empty
186 public static double min(double... array) {
187 checkArgument(array.length > 0);
188 double min = array[0];
189 for (int i = 1; i < array.length; i++) {
190 min = Math.min(min, array[i]);
196 * Returns the greatest value present in {@code array}, using the same rules
199 * @param array a <i>nonempty</i> array of {@code double} values
200 * @return the value present in {@code array} that is greater than or equal to
201 * every other value in the array
202 * @throws IllegalArgumentException if {@code array} is empty
204 public static double max(double... array) {
205 checkArgument(array.length > 0);
206 double max = array[0];
207 for (int i = 1; i < array.length; i++) {
208 max = Math.max(max, array[i]);
214 * Returns the values from each provided array combined into a single array.
216 * double[] {c}} returns the array {@code {a, b, c}}.
219 * @return a single array containing all the values from the source arrays, in
224 for (double[] array : arrays) {
225 length += array.length;
229 for (double[] array : arrays) {
230 System.arraycopy(array, 0, result, pos, array.length);
231 pos += array.length;
237 * Returns an array containing the same values as {@code array}, but
238 * guaranteed to be of a specified minimum length. If {@code array} already
240 * Otherwise, a new array of size {@code minLength + padding} is returned,
241 * containing the values of {@code array}, and zeroes in the remaining places.
243 * @param array the source array
244 * @param minLength the minimum length the returned array must guarantee
245 * @param padding an extra amount to "grow" the array by if growth is
249 * @return an array containing the values of {@code array}, with guaranteed
253 double[] array, int minLength, int padding) {
256 return (array.length < minLength)
257 ? copyOf(array, minLength + padding)
258 : array;
276 * @param array an array of {@code double} values, possibly empty
278 public static String join(String separator, double... array) {
280 if (array.length == 0) {
285 StringBuilder builder = new StringBuilder(array.length * 12);
286 builder.append(array[0]);
287 for (int i = 1; i < array.length; i++) {
288 builder.append(separator).append(array[i]);
297 * common prefix, or when one array is a prefix of the other, treats the
298 * shorter array as the lesser. For example,
329 * Copies a collection of {@code Double} instances into a new array of
337 * @return an array containing the same values as {@code collection}, in the
349 double[] array = new double[len];
351 array[i] = (Double) boxedArray[i];
353 return array;
357 * Returns a fixed-size list backed by the specified array, similar to {@link
370 * @param backingArray the array to back the list
371 * @return a list view of the array
383 final double[] array;
387 DoubleArrayAsList(double[] array) {
388 this(array, 0, array.length);
391 DoubleArrayAsList(double[] array, int start, int end) {
392 this.array = array;
407 return array[start + index];
413 && Doubles.indexOf(array, (Double) target, start, end) != -1;
419 int i = Doubles.indexOf(array, (Double) target, start, end);
430 int i = Doubles.lastIndexOf(array, (Double) target, start, end);
440 double oldValue = array[start + index];
441 array[start + index] = element;
452 return new DoubleArrayAsList(array, start + fromIndex, start + toIndex);
466 if (array[start + i] != that.array[that.start + i]) {
478 result = 31 * result + Doubles.hashCode(array[i]);
485 builder.append('[').append(array[start]);
487 builder.append(", ").append(array[i]);
496 System.arraycopy(array, start, result, 0, size);