List of utility methods to do ArrayList Average
double | average(ArrayList average double avg = 0.0; for (int i = 0; i < nums.size(); i++) { avg += nums.get(i); return avg / (double) nums.size(); |
double | average(ArrayList average Integer sum = 0; if (!array.isEmpty()) { for (Integer mark : array) { sum += mark; return sum.doubleValue() / array.size(); return sum; ... |
ArrayList | averageInColumns(ArrayList average In Columns ArrayList<ArrayList<String>> valuesInColumns = valuesInColumns(lines); ArrayList<String> result = new ArrayList<String>(); for (int i = 0; i < valuesInColumns.size(); i++) { ArrayList<String> values = valuesInColumns.get(i); Double sum = 0.0; for (String value : values) { try { sum = sum + Double.parseDouble(value); ... |
double | getAverage(ArrayList data) Small routines doing trivial stuff here double ave = 0; int i, size = data.size(); for (i = 0; i < size; i++) { ave += ((Double) data.get(i)).doubleValue(); ave /= (double) size; return ave; |
double | getAverage(ArrayList get Average double sum = 0; for (double value : values) { sum += value; return sum / values.size(); |
double | getAverageOfList(ArrayList Gets the average of a list of values semi-intelligently by removing outliers. int amountOutliers = 0; double addedUp = 0; for (int index = 0; index < values.size(); index++) { if (isOutlier(index, values)) { amountOutliers++; addedUp += values.get(index); return addedUp / (values.size() - amountOutliers); |