@Test public void testCreateEmployeeData() { Map<Integer, EmployeeData> data = Example.createEmployeeData(); assertEquals(14, data.size()); }
public static Map<Integer, EmployeeData> createEmployeeData() { String[] firstNames = "Alex,Bertie,Kris,Dale,Frankie,Jamie,Morgan,Pat,Ricky,Taylor,Casey,Jessie,Ryan,Skyler" .split(","); String[] lastNames = "Able,Bell,Call,Driver,Forth,Jive,Minnow,Puts,Reliable,Tack,Catch,Jam,Redo,Skip".split(","); int salaries[] = new int[] {60000, 80000, 75000, 90000, 100000}; int hours[] = new int[] {40, 40, 40, 40, 30, 20}; int emplNumber = 10000; Map<Integer, EmployeeData> employees = new HashMap<Integer, EmployeeData>(); for (int index = 0; index < firstNames.length; index++) { emplNumber = emplNumber + index; String email = firstNames[index] + "." + lastNames[index] + "@example.com"; int salary = salaries[index % 5]; int hoursPerWeek = hours[index % 6]; EmployeeData value = new EmployeeData(firstNames[index], lastNames[index], emplNumber, email, salary, hoursPerWeek); employees.put(emplNumber, value); } return employees; }
Example { public static Map<Integer, EmployeeData> createEmployeeData() { String[] firstNames = "Alex,Bertie,Kris,Dale,Frankie,Jamie,Morgan,Pat,Ricky,Taylor,Casey,Jessie,Ryan,Skyler" .split(","); String[] lastNames = "Able,Bell,Call,Driver,Forth,Jive,Minnow,Puts,Reliable,Tack,Catch,Jam,Redo,Skip".split(","); int salaries[] = new int[] {60000, 80000, 75000, 90000, 100000}; int hours[] = new int[] {40, 40, 40, 40, 30, 20}; int emplNumber = 10000; Map<Integer, EmployeeData> employees = new HashMap<Integer, EmployeeData>(); for (int index = 0; index < firstNames.length; index++) { emplNumber = emplNumber + index; String email = firstNames[index] + "." + lastNames[index] + "@example.com"; int salary = salaries[index % 5]; int hoursPerWeek = hours[index % 6]; EmployeeData value = new EmployeeData(firstNames[index], lastNames[index], emplNumber, email, salary, hoursPerWeek); employees.put(emplNumber, value); } return employees; } }
Example { public static Map<Integer, EmployeeData> createEmployeeData() { String[] firstNames = "Alex,Bertie,Kris,Dale,Frankie,Jamie,Morgan,Pat,Ricky,Taylor,Casey,Jessie,Ryan,Skyler" .split(","); String[] lastNames = "Able,Bell,Call,Driver,Forth,Jive,Minnow,Puts,Reliable,Tack,Catch,Jam,Redo,Skip".split(","); int salaries[] = new int[] {60000, 80000, 75000, 90000, 100000}; int hours[] = new int[] {40, 40, 40, 40, 30, 20}; int emplNumber = 10000; Map<Integer, EmployeeData> employees = new HashMap<Integer, EmployeeData>(); for (int index = 0; index < firstNames.length; index++) { emplNumber = emplNumber + index; String email = firstNames[index] + "." + lastNames[index] + "@example.com"; int salary = salaries[index % 5]; int hoursPerWeek = hours[index % 6]; EmployeeData value = new EmployeeData(firstNames[index], lastNames[index], emplNumber, email, salary, hoursPerWeek); employees.put(emplNumber, value); } return employees; }  }
Example { public static Map<Integer, EmployeeData> createEmployeeData() { String[] firstNames = "Alex,Bertie,Kris,Dale,Frankie,Jamie,Morgan,Pat,Ricky,Taylor,Casey,Jessie,Ryan,Skyler" .split(","); String[] lastNames = "Able,Bell,Call,Driver,Forth,Jive,Minnow,Puts,Reliable,Tack,Catch,Jam,Redo,Skip".split(","); int salaries[] = new int[] {60000, 80000, 75000, 90000, 100000}; int hours[] = new int[] {40, 40, 40, 40, 30, 20}; int emplNumber = 10000; Map<Integer, EmployeeData> employees = new HashMap<Integer, EmployeeData>(); for (int index = 0; index < firstNames.length; index++) { emplNumber = emplNumber + index; String email = firstNames[index] + "." + lastNames[index] + "@example.com"; int salary = salaries[index % 5]; int hoursPerWeek = hours[index % 6]; EmployeeData value = new EmployeeData(firstNames[index], lastNames[index], emplNumber, email, salary, hoursPerWeek); employees.put(emplNumber, value); } return employees; }  static void main(String[] args); static Map<Integer, EmployeeData> createEmployeeData(); static void doQueries(ClientCache cache); }
Example { public static Map<Integer, EmployeeData> createEmployeeData() { String[] firstNames = "Alex,Bertie,Kris,Dale,Frankie,Jamie,Morgan,Pat,Ricky,Taylor,Casey,Jessie,Ryan,Skyler" .split(","); String[] lastNames = "Able,Bell,Call,Driver,Forth,Jive,Minnow,Puts,Reliable,Tack,Catch,Jam,Redo,Skip".split(","); int salaries[] = new int[] {60000, 80000, 75000, 90000, 100000}; int hours[] = new int[] {40, 40, 40, 40, 30, 20}; int emplNumber = 10000; Map<Integer, EmployeeData> employees = new HashMap<Integer, EmployeeData>(); for (int index = 0; index < firstNames.length; index++) { emplNumber = emplNumber + index; String email = firstNames[index] + "." + lastNames[index] + "@example.com"; int salary = salaries[index % 5]; int hoursPerWeek = hours[index % 6]; EmployeeData value = new EmployeeData(firstNames[index], lastNames[index], emplNumber, email, salary, hoursPerWeek); employees.put(emplNumber, value); } return employees; }  static void main(String[] args); static Map<Integer, EmployeeData> createEmployeeData(); static void doQueries(ClientCache cache);  }