We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

Vestiaz • 4 years ago

In method 3 you could print it only if it exists by this way :
// Method 3: find the element that matches the condition
User bobby = users.stream()
.filter(user -> userToFind.equals(user.name))
.findFirst().ifPresent(b -> System.out.println("Bobby : " +b));