Arrays.asList(yourArray).contains(yourValue)
This method is not available for arrays that store primary types.
Stream allows you to find specific values in an array that has values of int, double, and long types.
int[] a = {1,2,3,4};
boolean contains = IntStream.of(a).anyMatch(x -> x == 4);
© 2024 OneMinuteCode. All rights reserved.