Check out example codes for "java 8 filter first". It will help you in understanding the concepts better.

Code Example 1

return dataSource.getParkingLots()
                 .stream()
                 .filter(parkingLot -> Objects.equals(parkingLot.getId(), id))
                 .findFirst()
                 .orElse(null);

Learn ReactJs, React Native from akashmittal.com