Skip to content

Commit 0d78fbc

Browse files
committed
Add LowestPaidEmployeeQ9 class to find and display the employee with the lowest salary
1 parent 264a53c commit 0d78fbc

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

.idea/misc.xml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.superthirty;
2+
3+
import java.util.Arrays;
4+
import java.util.Comparator;
5+
import java.util.List;
6+
import java.util.Optional;
7+
8+
public class LowestPaidEmployeeQ9 {
9+
public static void main(String[] args) {
10+
List<Employee> employees = EmployeeDTO.getEmployees();
11+
Optional<Employee> emp = employees.stream().min(Comparator.comparingDouble(Employee::getSalary));
12+
emp.ifPresent(x -> System.out.println(x.getName()));
13+
System.out.println(Arrays.toString(emp.stream().toArray()));
14+
}
15+
}

0 commit comments

Comments
 (0)