Java Array Contain arrayContainsNumber(Number[] array, Number number)

Here you can find the source of arrayContainsNumber(Number[] array, Number number)

Description

Returns whether or not the given array contains the given number.

License

Open Source License

Parameter

Parameter Description
array The array to check
number The number to find

Return

The result

Declaration

static boolean arrayContainsNumber(Number[] array, Number number) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.Arrays;

public class Main {
    /**/* w w  w  .j  a  va2s  .  co  m*/
     * Returns whether or not the given array contains the given number.
     *
     * @param array  The array to check
     * @param number The number to find
     * @return The result
     */
    static boolean arrayContainsNumber(Number[] array, Number number) {
        return Arrays.stream(array).filter(item -> item != null && item.equals(number)).count() > 0;
    }
}

Related

  1. arrayContainsEntry(T[] array, T entry)
  2. arrayContainsIgnoreCase(String[] array, String searchKey)
  3. arrayContainsIgnoreCase(String[] array, String str)
  4. arrayContainsInt(int[] array, int test)
  5. arrayContainsLower(String[] lemmas, String string)
  6. arrayContainsOK(final byte[] b)
  7. arrayContainsOnlyIgnoreCase(String[] array, String... strs)
  8. arrayContainsOverlap(Object[] array1, Object[] array2)
  9. arrayContainsPartKey(String[] array, String key)