@Test public void test() { List<Department> departments; List<Employee> employees; departments = Lists.deepCopy(departmentsList); employees = BeanUtils.idxList(Employee.class, departments, "employees"); IntCollector salaryCollection = new IntCollector("salary"); collectFrom( selects( salaryCollection ), employees); IntList list = salaryCollection.list(); puts("sum", list.sum()); puts("max", list.max()); puts("min", list.min()); puts("mean", list.mean()); puts("median", list.median()); puts("st.dev", list.standardDeviation()); equalsOrDie(2000, list.sum()); equalsOrDie(400, list.max()); equalsOrDie(100, list.min()); equalsOrDie(250, list.mean()); equalsOrDie(250, list.median()); equalsOrDie(112, list.standardDeviation()); list = toIntList(employees, "salary"); puts("sum", list.sum()); puts("max", list.max()); puts("min", list.min()); puts("mean", list.mean()); puts("median", list.median()); puts("st.dev", list.standardDeviation()); equalsOrDie(2000, list.sum()); equalsOrDie(400, list.max()); equalsOrDie(100, list.min()); equalsOrDie(250, list.mean()); equalsOrDie(250, list.median()); equalsOrDie(112, list.standardDeviation()); puts("sum", list.sum()); puts("max", list.max()); puts("min", list.min()); puts("mean", list.mean()); puts("median", list.median()); puts("st.dev", list.standardDeviation()); equalsOrDie(2000, (int) Int.sum(employees, "salary")); equalsOrDie(250, Int.median(employees, "salary")); equalsOrDie(112, (int) Int.standardDeviation(employees, "salary")); puts("sum", (int) Int.sum(employees, "salary")); puts("median", Int.median(employees, "salary")); puts("stdev", Int.standardDeviation(employees, "salary")); }
public IntList list() { return list; }
IntCollector extends Selector { public IntList list() { return list; } }
IntCollector extends Selector { public IntList list() { return list; } IntCollector(String fieldName); }
IntCollector extends Selector { public IntList list() { return list; } IntCollector(String fieldName); static IntCollector intCollector(String propertyName); @Override void handleRow(int index, Map<String, Object> row, Object item, Map<String, FieldAccess> fields); @Override void handleStart(Collection<?> results); @Override void handleComplete(List<Map<String, Object>> rows); IntList list(); }
IntCollector extends Selector { public IntList list() { return list; } IntCollector(String fieldName); static IntCollector intCollector(String propertyName); @Override void handleRow(int index, Map<String, Object> row, Object item, Map<String, FieldAccess> fields); @Override void handleStart(Collection<?> results); @Override void handleComplete(List<Map<String, Object>> rows); IntList list();  }