it's just calling a method called
rangeClosed
, then using the result of that to call a method called
anyMatch
with returns
true
if the condition evaluates to
true
on one or more of the items in the collection.
That
true
or
false
result is used to select 0 if it's
true
, and 1 if it's
false
Break it down into separate lines which store the result and it's more obviuous to beginners:
int result;
var range = IntStream.rangeClosed(0, middle);
var foundAMatch = range.anyMatch(i -> num.charAt(i) != num.charAt(pos - i));
if (foundAMatch) {
result = 0;
}
else {
result = 1;
}