strumień i filtr Java
items.stream()
.filter(s->s.contains("B"))
.forEach(System.out::println);
Good Goosander
items.stream()
.filter(s->s.contains("B"))
.forEach(System.out::println);
User user1 = new User("James", "Gosling", 63);
User user2 = new User("Ken", "Thompson", 75);
User user3 = new User("Richard", "Stallman", 65);
List<User> userList = Arrays.asList(user1, user2, user3);
userList.stream().filter(user -> (user.getSurname().contains("a") && (user.getAge().equals(65))) ).collect(Collectors.toList()).forEach(System.out::println);