Answers for "check if array contains a number in java"

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 "check if array contains a number in java"

Browse Popular Code Answers by Language