Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java stream filter

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);
Source by www.mobilhanem.com #
 
PREVIOUS NEXT
Tagged: #java #stream #filter
ADD COMMENT
Topic
Name
4+2 =