public static ArrayList<Employee> getPersonsWIthSalaryOver5000(ArrayList<Employee> allPersons) { ArrayList<Employee> persons = new ArrayList<>(); for (Employee p : allPersons) { if (p.getSalary() > 5000) { persons.add(p); } } return persons; }
public static ArrayList<Employee> getPersonsBySlaraYAndId(ArrayList<Employee> allPersons) { ArrayList<Employee> persons = new ArrayList<>(); for (Employee p : allPersons) { if (p.getSalary() > 5000 && p.getId() > 2) { persons.add(p); } } return persons; }
public static void getNamesAndSalaries(ArrayList<Employee> allPersons) { for (Employee p : allPersons) { System.out.println(p.getName() + " " + p.getSalary()); } }