I'm getting an error when filtering an array
The operator % is undefined for the argument type(s) int[], int
How do I get the iteration value using Java 8?
int[] values = new int[9000000];
Random random = new Random();
for (int i = 0; i < values.length; i++) {
values[i] = random.nextInt(9000000) + 1;
}
long counter = Stream.of(values)
.filter(x - > x % 3 == 0) // Error here
.count();
System.out.println(counter);