Question: what is the difference between map and filter in java 8?
Answer: Similar to map, the filter is also an intermediate operation, which means you can call other Stream methods after calling the filter. The filter() method is also lazy, meaning it will not be evaluated until you call a reduction method, like collect, and it will stop as soon as it reaches the target.