Home | History | Annotate | Download | only in primitives

Lines Matching refs:array

74    * {@code array}.
76 * <p><b>Note:</b> consider representing the array as a {@link
77 * BitSet} instead, replacing {@code Booleans.contains(array, true)}
78 * with {@code !bitSet.isEmpty()} and {@code Booleans.contains(array, false)}
81 * @param array an array of {@code boolean} values, possibly empty
83 * @return {@code true} if {@code array[i] == target} for some value of {@code
86 public static boolean contains(boolean[] array, boolean target) {
87 for (boolean value : array) {
97 * {@code array}.
99 * <p><b>Note:</b> consider representing the array as a {@link BitSet}
103 * @param array an array of {@code boolean} values, possibly empty
105 * @return the least index {@code i} for which {@code array[i] == target}, or
108 public static int indexOf(boolean[] array, boolean target) {
109 return indexOf(array, target, 0, array.length);
114 boolean[] array, boolean target, int start, int end) {
116 if (array[i] == target) {
125 * target} within {@code array}, or {@code -1} if there is no such occurrence.
128 * java.util.Arrays.copyOfRange(array, i, i + target.length)} contains exactly
131 * @param array the array to search for the sequence {@code target}
132 * @param target the array to search for as a sub-sequence of {@code array}
134 public static int indexOf(boolean[] array, boolean[] target) {
135 checkNotNull(array, "array");
142 for (int i = 0; i < array.length - target.length + 1; i++) {
144 if (array[i + j] != target[j]) {
155 * {@code array}.
157 * @param array an array of {@code boolean} values, possibly empty
159 * @return the greatest index {@code i} for which {@code array[i] == target},
162 public static int lastIndexOf(boolean[] array, boolean target) {
163 return lastIndexOf(array, target, 0, array.length);
168 boolean[] array, boolean target, int start, int end) {
170 if (array[i] == target) {
178 * Returns the values from each provided array combined into a single array.
180 * boolean[] {c}} returns the array {@code {a, b, c}}.
183 * @return a single array containing all the values from the source arrays, in
188 for (boolean[] array : arrays) {
189 length += array.length;
193 for (boolean[] array : arrays) {
194 System.arraycopy(array, 0, result, pos, array.length);
195 pos += array.length;
201 * Returns an array containing the same values as {@code array}, but
202 * guaranteed to be of a specified minimum length. If {@code array} already
204 * Otherwise, a new array of size {@code minLength + padding} is returned,
205 * containing the values of {@code array}, and zeroes in the remaining places.
207 * @param array the source array
208 * @param minLength the minimum length the returned array must guarantee
209 * @param padding an extra amount to "grow" the array by if growth is
213 * @return an array containing the values of {@code array}, with guaranteed
217 boolean[] array, int minLength, int padding) {
220 return (array.length < minLength)
221 ? copyOf(array, minLength + padding)
222 : array;
239 * @param array an array of {@code boolean} values, possibly empty
241 public static String join(String separator, boolean... array) {
243 if (array.length == 0) {
248 StringBuilder builder = new StringBuilder(array.length * 7);
249 builder.append(array[0]);
250 for (int i = 1; i < array.length; i++) {
251 builder.append(separator).append(array[i]);
260 * common prefix, or when one array is a prefix of the other, treats the
261 * shorter array as the lesser. For example,
292 * Copies a collection of {@code Boolean} instances into a new array of
303 * @return an array containing the same values as {@code collection}, in the
315 boolean[] array = new boolean[len];
317 array[i] = (Boolean) boxedArray[i];
319 return array;
323 * Returns a fixed-size list backed by the specified array, similar to {@link
333 * @param backingArray the array to back the list
334 * @return a list view of the array
346 final boolean[] array;
350 BooleanArrayAsList(boolean[] array) {
351 this(array, 0, array.length);
354 BooleanArrayAsList(boolean[] array, int start, int end) {
355 this.array = array;
370 return array[start + index];
376 && Booleans.indexOf(array, (Boolean) target, start, end) != -1;
382 int i = Booleans.indexOf(array, (Boolean) target, start, end);
393 int i = Booleans.lastIndexOf(array, (Boolean) target, start, end);
403 boolean oldValue = array[start + index];
404 array[start + index] = element;
415 return new BooleanArrayAsList(array, start + fromIndex, start + toIndex);
429 if (array[start + i] != that.array[that.start + i]) {
441 result = 31 * result + Booleans.hashCode(array[i]);
448 builder.append(array[start] ? "[true" : "[false");
450 builder.append(array[i] ? ", true" : ", false");
459 System.arraycopy(array, start, result, 0, size);