Here you can find the source of sumOfSquares(List
public static <T extends Number> double sumOfSquares(List<T> list)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { public static <T extends Number> double sumOfSquares(List<T> list) { double accum = 0; for (T item : list) { accum = accum + (item.doubleValue() * item.doubleValue()); }/*from ww w. j a v a2 s. com*/ return accum; } }