Created
April 29, 2016 19:53
-
-
Save cobratbq/c7e98ec7311fe15ea33babff55c9d854 to your computer and use it in GitHub Desktop.
Naive implementation of summing-method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Test { | |
public static void main(String[] args) { | |
final ArrayList<Double> list = new ArrayList<>(); | |
list.add(1.3); | |
list.add(1.4); | |
list.add(1.7); | |
list.add(2.3); | |
naiveSum(list); | |
} | |
public static void naiveSum(final ArrayList<Double> values) { | |
double sum = 0; | |
for (final double d : values) { | |
sum += d; | |
} | |
System.out.println(Double.toString(sum)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment