Lines Matching refs:array
134 * {@code array}.
136 * @param array an array of {@code primtyp} values, possibly empty
138 * @return {@code true} if {@code array[i] == target} for some value of {@code
141 public static boolean contains(primtyp[] array, primtyp target) {
142 for (primtyp value : array) {
152 * {@code array}.
154 * @param array an array of {@code primtyp} values, possibly empty
156 * @return the least index {@code i} for which {@code array[i] == target}, or
159 public static int indexOf(primtyp[] array, primtyp target) {
160 return indexOf(array, target, 0, array.length);
165 primtyp[] array, primtyp target, int start, int end) {
167 if (array[i] == target) {
176 * target} within {@code array}, or {@code -1} if there is no such occurrence.
179 * java.util.Arrays.copyOfRange(array, i, i + target.length)} contains exactly
182 * @param array the array to search for the sequence {@code target}
183 * @param target the array to search for as a sub-sequence of {@code array}
185 public static int indexOf(primtyp[] array, primtyp[] target) {
186 checkNotNull(array, "array");
193 for (int i = 0; i < array.length - target.length + 1; i++) {
195 if (array[i + j] != target[j]) {
206 * {@code array}.
208 * @param array an array of {@code primtyp} values, possibly empty
210 * @return the greatest index {@code i} for which {@code array[i] == target},
213 public static int lastIndexOf(primtyp[] array, primtyp target) {
214 return lastIndexOf(array, target, 0, array.length);
219 primtyp[] array, primtyp target, int start, int end) {
221 if (array[i] == target) {
229 * Returns the least value present in {@code array}.
231 * @param array a <i>nonempty</i> array of {@code primtyp} values
232 * @return the value present in {@code array} that is less than or equal to
233 * every other value in the array
234 * @throws IllegalArgumentException if {@code array} is empty
236 public static primtyp min(primtyp... array) {
237 checkArgument(array.length > 0);
238 primtyp min = array[0];
239 for (int i = 1; i < array.length; i++) {
240 if (array[i] < min) {
241 min = array[i];
248 * Returns the greatest value present in {@code array}.
250 * @param array a <i>nonempty</i> array of {@code primtyp} values
251 * @return the value present in {@code array} that is greater than or equal to
252 * every other value in the array
253 * @throws IllegalArgumentException if {@code array} is empty
255 public static primtyp max(primtyp... array) {
256 checkArgument(array.length > 0);
257 primtyp max = array[0];
258 for (int i = 1; i < array.length; i++) {
259 if (array[i] > max) {
260 max = array[i];
267 * Returns the values from each provided array combined into a single array.
269 * primtyp[] {c}} returns the array {@code {a, b, c}}.
272 * @return a single array containing all the values from the source arrays, in
277 for (primtyp[] array : arrays) {
278 length += array.length;
282 for (primtyp[] array : arrays) {
283 System.arraycopy(array, 0, result, pos, array.length);
284 pos += array.length;
291 * array; equivalent to {@code
292 * ByteBuffer.allocate(?).putPrimTyp(value).array()}. For example, the input
293 * value {@code ?} would yield the byte array {@code {?}}.
310 * ByteBuffer.wrap(bytes).getPrimTyp()}. For example, the input byte array
322 "array too small: %s < %s", bytes.length, BYTES);
327 * Returns an array containing the same values as {@code array}, but
328 * guaranteed to be of a specified minimum length. If {@code array} already
330 * Otherwise, a new array of size {@code minLength + padding} is returned,
331 * containing the values of {@code array}, and zeroes in the remaining places.
333 * @param array the source array
334 * @param minLength the minimum length the returned array must guarantee
335 * @param padding an extra amount to "grow" the array by if growth is
339 * @return an array containing the values of {@code array}, with guaranteed
343 primtyp[] array, int minLength, int padding) {
346 return (array.length < minLength)
347 ? copyOf(array, minLength + padding)
348 : array;
365 * @param array an array of {@code primtyp} values, possibly empty
367 public static String join(String separator, primtyp... array) {
369 if (array.length == 0) {
374 StringBuilder builder = new StringBuilder(array.length * ??);
375 builder.append(array[0]);
376 for (int i = 1; i < array.length; i++) {
377 builder.append(separator).append(array[i]);
386 * common prefix, or when one array is a prefix of the other, treats the
387 * shorter array as the lesser. For example, {@code [] < [1] < [1, 2] < [2]}.
417 * Copies a collection of {@code WrapperCl} instances into a new array of
425 * @return an array containing the same values as {@code collection}, in the
437 primtyp[] array = new primtyp[len];
439 array[i] = (WrapperCl) boxedArray[i];
441 return array;
445 * Returns a fixed-size list backed by the specified array, similar to {@link
455 * @param backingArray the array to back the list
456 * @return a list view of the array
468 final primtyp[] array;
472 PrimTypArrayAsList(primtyp[] array) {
473 this(array, 0, array.length);
476 PrimTypArrayAsList(primtyp[] array, int start, int end) {
477 this.array = array;
492 return array[start + index];
498 && PrimTyps.indexOf(array, (WrapperCl) target, start, end) != -1;
504 int i = PrimTyps.indexOf(array, (WrapperCl) target, start, end);
515 int i = PrimTyps.lastIndexOf(array, (WrapperCl) target, start, end);
525 primtyp oldValue = array[start + index];
526 array[start + index] = element;
537 return new PrimTypArrayAsList(array, start + fromIndex, start + toIndex);
551 if (array[start + i] != that.array[that.start + i]) {
563 result = 31 * result + PrimTyps.hashCode(array[i]);
570 builder.append('[').append(array[start]);
572 builder.append(", ").append(array[i]);
581 System.arraycopy(array, start, result, 0, size);