Answer: Java 8 introduced several landmark features:
(a, b) -> a + blist.stream().filter().map().collect()Runnable, Comparator, Predicate)NullPointerException by wrapping nullable valuesjava.time) – LocalDate, LocalTime, LocalDateTime, ZonedDateTimeString::toUpperCaseCollectors.toList(), groupingBy(), joining() etc.Follow-up Questions:
“What is the difference between
map()andflatMap()in Stream?”
map() transforms each element 1-to-1. flatMap() flattens a stream of streams into a single stream.“What is a Functional Interface? Can it have default methods?”
“What problem does
Optionalsolve?”
Optional.ofNullable(), .isPresent(), .orElse().