Compare two integer arrays using Java Stream
Same as other answers with a bit difference
List<Integer> result = IntStream.rangeClosed(0,a.length-1)
.boxed()
.map(i->Integer.compare(a[i],b[i]))
.collect(Collectors.toList());
You may do it like so,
List<Boolean> equalityResult = IntStream.range(0, a.length).mapToObj(i -> a[i] == b[i])
.collect(Collectors.toList());
Precondition: both the arrays are of same size.
Assuming the length of both the input arrays are same
List<Integer> list = IntStream.range(0, a.length).mapToObj(i -> Integer.compare(a[i], b[i]))
.collect(Collectors.toCollection(() -> new ArrayList<>(a.length)));