/** * Returns the index of the last appearance of the value {@code target} in {@code array}. * * @param array an array of {@code boolean} values, possibly empty * @param target a primitive {@code boolean} value * @return the greatest index {@code i} for which {@code array[i] == target}, or {@code -1} if no * such index exists. */ public static int lastIndexOf(boolean[] array, boolean target) { return lastIndexOf(array, target, 0, array.length); }
/** * Returns the index of the last appearance of the value {@code target} in {@code array}. * * @param array an array of {@code boolean} values, possibly empty * @param target a primitive {@code boolean} value * @return the greatest index {@code i} for which {@code array[i] == target}, or {@code -1} if no * such index exists. */ public static int lastIndexOf(boolean[] array, boolean target) { return lastIndexOf(array, target, 0, array.length); }
/** * Returns the index of the last appearance of the value {@code target} in {@code array}. * * @param array an array of {@code boolean} values, possibly empty * @param target a primitive {@code boolean} value * @return the greatest index {@code i} for which {@code array[i] == target}, or {@code -1} if no * such index exists. */ public static int lastIndexOf(boolean[] array, boolean target) { return lastIndexOf(array, target, 0, array.length); }
public void testLastIndexOf() { assertEquals(-1, Booleans.lastIndexOf(EMPTY, false)); assertEquals(-1, Booleans.lastIndexOf(ARRAY_FALSE, true)); assertEquals(-1, Booleans.lastIndexOf(ARRAY_FALSE_FALSE, true)); assertEquals(0, Booleans.lastIndexOf(ARRAY_FALSE, false)); assertEquals(0, Booleans.lastIndexOf(ARRAY_FALSE_TRUE, false)); assertEquals(1, Booleans.lastIndexOf(ARRAY_FALSE_TRUE, true)); assertEquals(2, Booleans.lastIndexOf(new boolean[] {false, true, true}, true)); }
/** * Returns the index of the last appearance of the value {@code target} in * {@code array}. * * @param array an array of {@code boolean} values, possibly empty * @param target a primitive {@code boolean} value * @return the greatest index {@code i} for which {@code array[i] == target}, * or {@code -1} if no such index exists. */ public static int lastIndexOf(boolean[] array, boolean target) { return lastIndexOf(array, target, 0, array.length); }
/** * Returns the index of the last appearance of the value {@code target} in * {@code array}. * * @param array an array of {@code boolean} values, possibly empty * @param target a primitive {@code boolean} value * @return the greatest index {@code i} for which {@code array[i] == target}, * or {@code -1} if no such index exists. */ public static int lastIndexOf(boolean[] array, boolean target) { return lastIndexOf(array, target, 0, array.length); }
/** * Returns the index of the last appearance of the value {@code target} in * {@code array}. * * @param array an array of {@code boolean} values, possibly empty * @param target a primitive {@code boolean} value * @return the greatest index {@code i} for which {@code array[i] == target}, * or {@code -1} if no such index exists. */ public static int lastIndexOf(boolean[] array, boolean target) { return lastIndexOf(array, target, 0, array.length); }
/** * Returns the index of the last appearance of the value {@code target} in * {@code array}. * * @param array an array of {@code boolean} values, possibly empty * @param target a primitive {@code boolean} value * @return the greatest index {@code i} for which {@code array[i] == target}, * or {@code -1} if no such index exists. */ public static int lastIndexOf(boolean[] array, boolean target) { return lastIndexOf(array, target, 0, array.length); }
/** * Returns the index of the last appearance of the value {@code target} in * {@code array}. * * @param array an array of {@code boolean} values, possibly empty * @param target a primitive {@code boolean} value * @return the greatest index {@code i} for which {@code array[i] == target}, * or {@code -1} if no such index exists. */ public static int lastIndexOf(boolean[] array, boolean target) { return lastIndexOf(array, target, 0, array.length); }
/** * Returns the index of the last appearance of the value {@code target} in * {@code array}. * * @param array an array of {@code boolean} values, possibly empty * @param target a primitive {@code boolean} value * @return the greatest index {@code i} for which {@code array[i] == target}, * or {@code -1} if no such index exists. */ public static int lastIndexOf(boolean[] array, boolean target) { return lastIndexOf(array, target, 0, array.length); }
/** * Returns the index of the last appearance of the value {@code target} in {@code array}. * * @param array an array of {@code boolean} values, possibly empty * @param target a primitive {@code boolean} value * @return the greatest index {@code i} for which {@code array[i] == target}, or {@code -1} if no * such index exists. */ public static int lastIndexOf(boolean[] array, boolean target) { return lastIndexOf(array, target, 0, array.length); }
/** * Returns the index of the last appearance of the value {@code target} in * {@code array}. * * @param array an array of {@code boolean} values, possibly empty * @param target a primitive {@code boolean} value * @return the greatest index {@code i} for which {@code array[i] == target}, * or {@code -1} if no such index exists. */ public static int lastIndexOf(boolean[] array, boolean target) { return lastIndexOf(array, target, 0, array.length); }
/** * Returns the index of the last appearance of the value {@code target} in * {@code array}. * * @param array an array of {@code boolean} values, possibly empty * @param target a primitive {@code boolean} value * @return the greatest index {@code i} for which {@code array[i] == target}, * or {@code -1} if no such index exists. */ public static int lastIndexOf(boolean[] array, boolean target) { return lastIndexOf(array, target, 0, array.length); }
/** * Returns the index of the last appearance of the value {@code target} in * {@code array}. * * @param array an array of {@code boolean} values, possibly empty * @param target a primitive {@code boolean} value * @return the greatest index {@code i} for which {@code array[i] == target}, * or {@code -1} if no such index exists. */ public static int lastIndexOf(boolean[] array, boolean target) { return lastIndexOf(array, target, 0, array.length); }
/** * Returns the index of the last appearance of the value {@code target} in * {@code array}. * * @param array an array of {@code boolean} values, possibly empty * @param target a primitive {@code boolean} value * @return the greatest index {@code i} for which {@code array[i] == target}, * or {@code -1} if no such index exists. */ public static int lastIndexOf(boolean[] array, boolean target) { return lastIndexOf(array, target, 0, array.length); }
/** * Returns the index of the last appearance of the value {@code target} in {@code array}. * * @param array an array of {@code boolean} values, possibly empty * @param target a primitive {@code boolean} value * @return the greatest index {@code i} for which {@code array[i] == target}, or {@code -1} if no * such index exists. */ public static int lastIndexOf(boolean[] array, boolean target) { return lastIndexOf(array, target, 0, array.length); }
/** * Returns the index of the last appearance of the value {@code target} in * {@code array}. * * @param array an array of {@code boolean} values, possibly empty * @param target a primitive {@code boolean} value * @return the greatest index {@code i} for which {@code array[i] == target}, * or {@code -1} if no such index exists. */ public static int lastIndexOf(boolean[] array, boolean target) { return lastIndexOf(array, target, 0, array.length); }
/** * {@inheritDoc} * * @throws NullPointerException * if the wrapped array was <code>null</code>. */ @Override public int lastIndexOf(Object o) { // Will make the method fail if array is null. if (size() < 1) { return -1; } if (o instanceof Boolean) { return Booleans.lastIndexOf(array, ((Boolean) o).booleanValue()); } return -1; }
public void testLastIndexOf() { assertEquals(-1, Booleans.lastIndexOf(EMPTY, false)); assertEquals(-1, Booleans.lastIndexOf(ARRAY_FALSE, true)); assertEquals(-1, Booleans.lastIndexOf(ARRAY_FALSE_FALSE, true)); assertEquals(0, Booleans.lastIndexOf(ARRAY_FALSE, false)); assertEquals(0, Booleans.lastIndexOf(ARRAY_FALSE_TRUE, false)); assertEquals(1, Booleans.lastIndexOf(ARRAY_FALSE_TRUE, true)); assertEquals(2, Booleans.lastIndexOf(new boolean[] {false, true, true}, true)); }