When we write following code
Stream.of(1,2,3,4,5).filter(i -> (i%2 == 0)).map( i -> i*i );
the expression i -> (i%2 == 0)
or i -> i*i
will turn into a private method.
In my usecase, one of the junit test is written to ensure no method is private (yaah, that’s mandated), and it fails for these lambda expression.
Can someone suggest something wherein I don't have to change junit to add some exclusion for lambda expressions, but make these expression to make a protected method internally?
protected static boolean isEvent(int i){
return i %2 == 0
}
ints.stream().filter(MyClass::isEvent)