예제 #1
0
 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;
 }
예제 #2
0
 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;
 }
예제 #3
0
 public static void getNamesAndSalaries(ArrayList<Employee> allPersons) {
   for (Employee p : allPersons) {
     System.out.println(p.getName() + " " + p.getSalary());
   }
 }