Answers for "java function to find if an array contains an integer"

0

check if array contains a number in java

public static boolean contains(final int[] arr, final int key) {
    return Arrays.stream(arr).anyMatch(i -> i == key);
}
Posted by: Guest on May-24-2021

Code answers related to "java function to find if an array contains an integer"

Browse Popular Code Answers by Language