Medium
Given this structure
record Mall(Collection<Shop> shops) {}
record Shop(Collection<Employee> employees) {}
record Employee(int age) {}
And this code
Shop firstShop = new Shop(List.of(new Employee(15), new Employee(17)));
Shop secondShop = new Shop(List.of(new Employee(12), new Employee(40)));
int result = new Mall(List.of(firstShop, secondShop))
.shops()
.stream()
.flatMap(shop -> shop.employees()
.stream()
.map(Employee::age))
.mapToInt(Integer::valueOf)
.max()
.orElseThrow();
What is the value of result?
Author: Clément DevosStatus: PublishedQuestion passed 315 times
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!
1
A Java class that converts Arabic numbers to Roman numerals.1
Java code that replaces keys in a template with their values.1
What does SRP stand for?1
Write a Java implementation of the FizzBuzz code kata.2
Write a function that returns the first character of a string in Java4
This code allows to randomly get numbers between 1 to 31 in results. Should have declard SimpleDateFormat in the Thread.1
What is the name of the design pattern used to structure complex applications by considering the problem domain?