@Test public void findEmployeeById() { this.company.addEmployee(new Employee("123", "Dave", 100_000.00)); this.company.addEmployee(new Employee("456", "Alice", 100_000.00)); this.company.addEmployee(new Employee("789", "Bob", 100_000.00)); Employee hopefullyDave = this.company.findEmployeeById("123"); Employee hopefullyNoOne = this.company.findEmployeeById("999"); }
public Employee findEmployeeById(String id) { int foundIndex = 0; for (int i = 0; i < this.employees.size(); i++) { if (this.employees.get(i).getId().equals(id)) { foundIndex = i; break; } } return this.employees.get(foundIndex); }
Company { public Employee findEmployeeById(String id) { int foundIndex = 0; for (int i = 0; i < this.employees.size(); i++) { if (this.employees.get(i).getId().equals(id)) { foundIndex = i; break; } } return this.employees.get(foundIndex); } }
Company { public Employee findEmployeeById(String id) { int foundIndex = 0; for (int i = 0; i < this.employees.size(); i++) { if (this.employees.get(i).getId().equals(id)) { foundIndex = i; break; } } return this.employees.get(foundIndex); } Company(String newName); }
Company { public Employee findEmployeeById(String id) { int foundIndex = 0; for (int i = 0; i < this.employees.size(); i++) { if (this.employees.get(i).getId().equals(id)) { foundIndex = i; break; } } return this.employees.get(foundIndex); } Company(String newName); String getName(); void setName(String newName); void addEmployee(Employee newEmployee); void everybodyGetsRaiseBy(double incrementAsFraction); Employee findEmployeeById(String id); int numberOfEmployees(); }
Company { public Employee findEmployeeById(String id) { int foundIndex = 0; for (int i = 0; i < this.employees.size(); i++) { if (this.employees.get(i).getId().equals(id)) { foundIndex = i; break; } } return this.employees.get(foundIndex); } Company(String newName); String getName(); void setName(String newName); void addEmployee(Employee newEmployee); void everybodyGetsRaiseBy(double incrementAsFraction); Employee findEmployeeById(String id); int numberOfEmployees();  }