-
Notifications
You must be signed in to change notification settings - Fork 274
Expand file tree
/
Copy pathTaxService.java
More file actions
19 lines (14 loc) · 578 Bytes
/
Copy pathTaxService.java
File metadata and controls
19 lines (14 loc) · 578 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package com.javatechie.stream.api.example;
import java.util.List;
import java.util.stream.Collectors;
public class TaxService {
public static List<Employee> evaluateTaxUsers(String input) {
return (input.equalsIgnoreCase("tax"))
? DataBase.getEmployees().stream().filter(emp -> emp.getSalary() > 500000).collect(Collectors.toList())
: DataBase.getEmployees().stream().filter(emp -> emp.getSalary() <= 500000)
.collect(Collectors.toList());
}
public static void main(String[] args) {
System.out.println(evaluateTaxUsers("tax"));
}
}