Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save trycf/4821230c2aab13f8618717aa2f83da1a to your computer and use it in GitHub Desktop.
Save trycf/4821230c2aab13f8618717aa2f83da1a to your computer and use it in GitHub Desktop.
TryCF Gist
<cfscript>
stats = createObject("java", "java.util.DoubleSummaryStatistics").init();
numbers = [9.5,20,25,30.5];
for (n in numbers) {
stats.accept(javaCast("double", n));
}
</cfscript>
<cfoutput>
Avg: #stats.getAverage()#<br>
Min: #stats.getMin()#<br>
Max: #stats.getMax()#<br>
Sum: #stats.getSum()#<br>
Count: #stats.getCount()#
</cfoutput>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment