I am new to java 8 and I am learning method reference. I was coding and I used lambda expression in the below case. But the sonar lint says that the below lines can be further reduces by using method reference. Now I am confused about it's implemenetation as there is
- Typecasting
I read that in method refernce should be used when we are just passing what is coming. For example
o -> System.out.println(o)
could be written asSystem.out::println
Can method reference be implemented in the below caseExpectedCondition<Boolean> cc = (x) -> { JavascriptExecutor j = (JavascriptExecutor) x; return (Boolean) j.executeScript("return document.readyState").toString().equals(completeString); };