List of utility methods to do Collection Median
Double | median(Collection median List<Double> filteredValues = filterNulls(values); if (filteredValues.size() == 0) return 0.; if (filteredValues.size() == 1) return filteredValues.get(0); Collections.sort(filteredValues); if (filteredValues.size() % 2 == 0) { return (filteredValues.get(filteredValues.size() / 2) ... |
T | median00(Collection median if (coll.isEmpty()) { return null; } else { List<T> copy = new ArrayList<T>(coll); Collections.sort(copy); int index = (copy.size() - 1) / 2; return copy.get(index); |