Android Collection Average getIntListAvg(Collection c)

Here you can find the source of getIntListAvg(Collection c)

Description

get Int List Avg

Declaration

public static int getIntListAvg(Collection<Integer> c) 

Method Source Code

//package com.java2s;
import java.util.Collection;

public class Main {

    public static int getIntListAvg(Collection<Integer> c) {
        return getIntListSum(c) / c.size();
    }//from  w  ww. j av  a2  s  .co m

    public static int getIntListSum(Collection<Integer> c) {
        int sum = 0;
        for (Integer i : c) {
            sum += i;
        }
        return sum;
    }
}

Related

  1. getLongListAvg(Collection c)