long sum = 0; for (Iterator<Long> iter = list.iterator(); iter.hasNext();) { sum += iter.next(); }