Home | History | Annotate | Download | only in primitives

Lines Matching full:array

111    * {@code array}.
113 * @param array an array of {@code char} values, possibly empty
115 * @return {@code true} if {@code array[i] == target} for some value of {@code
118 public static boolean contains(char[] array, char target) {
119 for (char value : array) {
129 * {@code array}.
131 * @param array an array of {@code char} values, possibly empty
133 * @return the least index {@code i} for which {@code array[i] == target}, or
136 public static int indexOf(char[] array, char target) {
137 return indexOf(array, target, 0, array.length);
142 char[] array, char target, int start, int end) {
144 if (array[i] == target) {
153 * target} within {@code array}, or {@code -1} if there is no such occurrence.
156 * java.util.Arrays.copyOfRange(array, i, i + target.length)} contains exactly
159 * @param array the array to search for the sequence {@code target}
160 * @param target the array to search for as a sub-sequence of {@code array}
162 public static int indexOf(char[] array, char[] target) {
163 checkNotNull(array, "array");
170 for (int i = 0; i < array.length - target.length + 1; i++) {
172 if (array[i + j] != target[j]) {
183 * {@code array}.
185 * @param array an array of {@code char} values, possibly empty
187 * @return the greatest index {@code i} for which {@code array[i] == target},
190 public static int lastIndexOf(char[] array, char target) {
191 return lastIndexOf(array, target, 0, array.length);
196 char[] array, char target, int start, int end) {
198 if (array[i] == target) {
206 * Returns the least value present in {@code array}.
208 * @param array a <i>nonempty</i> array of {@code char} values
209 * @return the value present in {@code array} that is less than or equal to
210 * every other value in the array
211 * @throws IllegalArgumentException if {@code array} is empty
213 public static char min(char... array) {
214 checkArgument(array.length > 0);
215 char min = array[0];
216 for (int i = 1; i < array.length; i++) {
217 if (array[i] < min) {
218 min = array[i];
225 * Returns the greatest value present in {@code array}.
227 * @param array a <i>nonempty</i> array of {@code char} values
228 * @return the value present in {@code array} that is greater than or equal to
229 * every other value in the array
230 * @throws IllegalArgumentException if {@code array} is empty
232 public static char max(char... array) {
233 checkArgument(array.length > 0);
234 char max = array[0];
235 for (int i = 1; i < array.length; i++) {
236 if (array[i] > max) {
237 max = array[i];
244 * Returns the values from each provided array combined into a single array.
246 * char[] {c}} returns the array {@code {a, b, c}}.
249 * @return a single array containing all the values from the source arrays, in
254 for (char[] array : arrays) {
255 length += array.length;
259 for (char[] array : arrays) {
260 System.arraycopy(array, 0, result, pos, array.length);
261 pos += array.length;
268 * array; equivalent to {@code
269 * ByteBuffer.allocate(2).putChar(value).array()}. For example, the input
270 * value {@code '\\u5432'} would yield the byte array {@code {0x54, 0x32}}.
287 * ByteBuffer.wrap(bytes).getChar()}. For example, the input byte array
299 "array too small: %s < %s", bytes.length, BYTES);
304 * Returns an array containing the same values as {@code array}, but
305 * guaranteed to be of a specified minimum length. If {@code array} already
307 * Otherwise, a new array of size {@code minLength + padding} is returned,
308 * containing the values of {@code array}, and zeroes in the remaining places.
310 * @param array the source array
311 * @param minLength the minimum length the returned array must guarantee
312 * @param padding an extra amount to "grow" the array by if growth is
316 * @return an array containing the values of {@code array}, with guaranteed
320 char[] array, int minLength, int padding) {
323 return (array.length < minLength)
324 ? copyOf(array, minLength + padding)
325 : array;
342 * @param array an array of {@code char} values, possibly empty
344 public static String join(String separator, char... array) {
346 int len = array.length;
353 builder.append(array[0]);
355 builder.append(separator).append(array[i]);
364 * common prefix, or when one array is a prefix of the other, treats the
365 * shorter array as the lesser. For example,
396 * Copies a collection of {@code Character} instances into a new array of
404 * @return an array containing the same values as {@code collection}, in the
416 char[] array = new char[len];
418 array[i] = (Character) boxedArray[i];
420 return array;
424 * Returns a fixed-size list backed by the specified array, similar to {@link
434 * @param backingArray the array to back the list
435 * @return a list view of the array
447 final char[] array;
451 CharArrayAsList(char[] array) {
452 this(array, 0, array.length);
455 CharArrayAsList(char[] array, int start, int end) {
456 this.array = array;
471 return array[start + index];
477 && Chars.indexOf(array, (Character) target, start, end) != -1;
483 int i = Chars.indexOf(array, (Character) target, start, end);
494 int i = Chars.lastIndexOf(array, (Character) target, start, end);
504 char oldValue = array[start + index];
505 array[start + index] = element;
516 return new CharArrayAsList(array, start + fromIndex, start + toIndex);
530 if (array[start + i] != that.array[that.start + i]) {
542 result = 31 * result + Chars.hashCode(array[i]);
549 builder.append('[').append(array[start]);
551 builder.append(", ").append(array[i]);
560 System.arraycopy(array, start, result, 0, size);