Java Utililty Methods ArrayList Average

List of utility methods to do ArrayList Average

Description

The list of methods to do ArrayList Average are organized into topic(s).

Method

doubleaverage(ArrayList nums)
average
double avg = 0.0;
for (int i = 0; i < nums.size(); i++) {
    avg += nums.get(i);
return avg / (double) nums.size();
doubleaverage(ArrayList array)
average
Integer sum = 0;
if (!array.isEmpty()) {
    for (Integer mark : array) {
        sum += mark;
    return sum.doubleValue() / array.size();
return sum;
...
ArrayListaverageInColumns(ArrayList lines)
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);
...
doublegetAverage(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;
doublegetAverage(ArrayList values)
get Average
double sum = 0;
for (double value : values) {
    sum += value;
return sum / values.size();
doublegetAverageOfList(ArrayList values)
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);