/** * <p>Checks if the value is in the given array.</p> * * <p>The method returns <code>false</code> if a <code>null</code> array is passed in.</p> * * @param array the array to search through * @param valueToFind the value to find * @return <code>true</code> if the array contains the object */ public static boolean contains(short[] array, short valueToFind) { return indexOf(array, valueToFind) != INDEX_NOT_FOUND; }
/** * <p>Checks if the object is in the given array.</p> * * <p>The method returns <code>false</code> if a <code>null</code> array is passed in.</p> * * @param array the array to search through * @param objectToFind the object to find * @return <code>true</code> if the array contains the object */ public static boolean contains(Object[] array, Object objectToFind) { return indexOf(array, objectToFind) != INDEX_NOT_FOUND; }
/** * <p>Checks if the value is in the given array.</p> * * <p>The method returns <code>false</code> if a <code>null</code> array is passed in.</p> * * @param array the array to search through * @param valueToFind the value to find * @return <code>true</code> if the array contains the object */ public static boolean contains(long[] array, long valueToFind) { return indexOf(array, valueToFind) != INDEX_NOT_FOUND; }
/** * <p>Checks if the value is in the given array.</p> * * <p>The method returns <code>false</code> if a <code>null</code> array is passed in.</p> * * @param array the array to search through * @param valueToFind the value to find * @return <code>true</code> if the array contains the object */ public static boolean contains(byte[] array, byte valueToFind) { return indexOf(array, valueToFind) != INDEX_NOT_FOUND; }
/** * <p>Checks if the value is in the given array.</p> * * <p>The method returns <code>false</code> if a <code>null</code> array is passed in.</p> * * @param array the array to search through * @param valueToFind the value to find * @return <code>true</code> if the array contains the object */ public static boolean contains(float[] array, float valueToFind) { return indexOf(array, valueToFind) != INDEX_NOT_FOUND; }
/** * <p>Checks if the value is in the given array.</p> * * <p>The method returns <code>false</code> if a <code>null</code> array is passed in.</p> * * @param array the array to search through * @param valueToFind the value to find * @return <code>true</code> if the array contains the object */ public static boolean contains(int[] array, int valueToFind) { return indexOf(array, valueToFind) != INDEX_NOT_FOUND; }
/** * <p>Checks if the value is in the given array.</p> * * <p>The method returns <code>false</code> if a <code>null</code> array is passed in.</p> * * @param array the array to search through * @param valueToFind the value to find * @return <code>true</code> if the array contains the object */ public static boolean contains(boolean[] array, boolean valueToFind) { return indexOf(array, valueToFind) != INDEX_NOT_FOUND; }
/** * <p>Finds the index of the given value in the array.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} (<code>-1</code>) for a <code>null</code> input array.</p> * * @param array the array to search through for the object, may be <code>null</code> * @param valueToFind the value to find * @return the index of the value within the array, * {@link #INDEX_NOT_FOUND} (<code>-1</code>) if not found or <code>null</code> array input */ public static int indexOf(float[] array, float valueToFind) { return indexOf(array, valueToFind, 0); }
/** * <p>Checks if the value is in the given array.</p> * * <p>The method returns <code>false</code> if a <code>null</code> array is passed in.</p> * * @param array the array to search through * @param valueToFind the value to find * @return <code>true</code> if the array contains the object */ public static boolean contains(double[] array, double valueToFind) { return indexOf(array, valueToFind) != INDEX_NOT_FOUND; }
/** * <p>Finds the index of the given value in the array.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} (<code>-1</code>) for a <code>null</code> input array.</p> * * @param array the array to search through for the object, may be <code>null</code> * @param valueToFind the value to find * @return the index of the value within the array, * {@link #INDEX_NOT_FOUND} (<code>-1</code>) if not found or <code>null</code> array input */ public static int indexOf(int[] array, int valueToFind) { return indexOf(array, valueToFind, 0); }
/** * <p>Finds the index of the given value in the array.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} (<code>-1</code>) for a <code>null</code> input array.</p> * * @param array the array to search through for the object, may be <code>null</code> * @param valueToFind the value to find * @return the index of the value within the array, * {@link #INDEX_NOT_FOUND} (<code>-1</code>) if not found or <code>null</code> array input */ public static int indexOf(long[] array, long valueToFind) { return indexOf(array, valueToFind, 0); }
/** * <p>Finds the index of the given object in the array.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} (<code>-1</code>) for a <code>null</code> input array.</p> * * @param array the array to search through for the object, may be <code>null</code> * @param objectToFind the object to find, may be <code>null</code> * @return the index of the object within the array, * {@link #INDEX_NOT_FOUND} (<code>-1</code>) if not found or <code>null</code> array input */ public static int indexOf(Object[] array, Object objectToFind) { return indexOf(array, objectToFind, 0); }
/** * <p>Finds the index of the given value in the array.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} (<code>-1</code>) for a <code>null</code> input array.</p> * * @param array the array to search through for the object, may be <code>null</code> * @param valueToFind the value to find * @return the index of the value within the array, * {@link #INDEX_NOT_FOUND} (<code>-1</code>) if not found or <code>null</code> array input */ public static int indexOf(double[] array, double valueToFind) { return indexOf(array, valueToFind, 0); }
/** * <p>Finds the index of the given value in the array.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} (<code>-1</code>) for a <code>null</code> input array.</p> * * @param array the array to search through for the object, may be <code>null</code> * @param valueToFind the value to find * @return the index of the value within the array, * {@link #INDEX_NOT_FOUND} (<code>-1</code>) if not found or <code>null</code> array input */ public static int indexOf(boolean[] array, boolean valueToFind) { return indexOf(array, valueToFind, 0); }
/** * <p>Finds the index of the given value in the array.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} (<code>-1</code>) for a <code>null</code> input array.</p> * * @param array the array to search through for the object, may be <code>null</code> * @param valueToFind the value to find * @return the index of the value within the array, * {@link #INDEX_NOT_FOUND} (<code>-1</code>) if not found or <code>null</code> array input */ public static int indexOf(short[] array, short valueToFind) { return indexOf(array, valueToFind, 0); }
/** * <p>Checks if the value is in the given array.</p> * * <p>The method returns <code>false</code> if a <code>null</code> array is passed in.</p> * * @param array the array to search through * @param valueToFind the value to find * @return <code>true</code> if the array contains the object * @since 2.1 */ public static boolean contains(char[] array, char valueToFind) { return indexOf(array, valueToFind) != INDEX_NOT_FOUND; }
/** * <p>Finds the index of the given value in the array.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} (<code>-1</code>) for a <code>null</code> input array.</p> * * @param array the array to search through for the object, may be <code>null</code> * @param valueToFind the value to find * @return the index of the value within the array, * {@link #INDEX_NOT_FOUND} (<code>-1</code>) if not found or <code>null</code> array input */ public static int indexOf(byte[] array, byte valueToFind) { return indexOf(array, valueToFind, 0); }
/** * <p>Finds the index of the given value in the array.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} (<code>-1</code>) for a <code>null</code> input array.</p> * * @param array the array to search through for the object, may be <code>null</code> * @param valueToFind the value to find * @return the index of the value within the array, * {@link #INDEX_NOT_FOUND} (<code>-1</code>) if not found or <code>null</code> array input * @since 2.1 */ public static int indexOf(char[] array, char valueToFind) { return indexOf(array, valueToFind, 0); }
/** * <p>Tests if the list of method names used in the search for <code>Throwable</code> * objects include the given name.</p> * * @param methodName the methodName to search in the list. * @return if the list of method names used in the search for <code>Throwable</code> * objects include the given name. * @since 2.1 */ public static boolean isCauseMethodName(String methodName) { synchronized(CAUSE_METHOD_NAMES_LOCK) { return ArrayUtils.indexOf(CAUSE_METHOD_NAMES, methodName) >= 0; } }
/** * <p>Checks if a value falling within the given tolerance is in the * given array. If the array contains a value within the inclusive range * defined by (value - tolerance) to (value + tolerance).</p> * * <p>The method returns <code>false</code> if a <code>null</code> array * is passed in.</p> * * @param array the array to search * @param valueToFind the value to find * @param tolerance the array contains the tolerance of the search * @return true if value falling within tolerance is in array */ public static boolean contains(double[] array, double valueToFind, double tolerance) { return indexOf(array, valueToFind, 0, tolerance) != INDEX_NOT_FOUND; }