@Test public void test() { List<Department> departments; List<Employee> employees; departments = Lists.deepCopy(departmentsList); employees = BeanUtils.idxList(Employee.class, departments, "employees"); DoubleCollector salaryCollection = new DoubleCollector("salary"); collectFrom( selects( salaryCollection ), employees); DoubleList 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(111.80339887498948, list.standardDeviation()); list = toDoubleList(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(111.80339887498948, list.standardDeviation()); }
public DoubleList list() { return list; }
DoubleCollector extends Selector { public DoubleList list() { return list; } }
DoubleCollector extends Selector { public DoubleList list() { return list; } DoubleCollector(String fieldName); }
DoubleCollector extends Selector { public DoubleList list() { return list; } DoubleCollector(String fieldName); static DoubleCollector 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); DoubleList list(); }
DoubleCollector extends Selector { public DoubleList list() { return list; } DoubleCollector(String fieldName); static DoubleCollector 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); DoubleList list();  }