import java.util.ArrayList;
import java.util.List;
class Employee {
private int id;
private String name;
private float salary;
public Employee(int id, String name, float salary) {
this.id = id;
this.name = name;
this.salary = salary;
}
public float getSalary() {
return salary;
}
}
public class Main {
public static void main(String[] args) {
List<Employee> employees = new ArrayList<>();
employees.add(new Employee(1, "Alice", 6000f));
employees.add(new Employee(2, "Bob", 4000f));
employees.add(new Employee(3, "Charlie", 7000f));
float totalSalary = employees.stream()
.filter(employee -> employee.getSalary() > 5000)
.mapToFloat(Employee::getSalary)
.sum();
System.out.println("工资总和: " + totalSalary);
}
}