Yan Cui edited this page Sep 10, 2013
·
5 revisions
Live demo is available here.
The StreamExt.sum
function returns the sum of the elements as a Future
, using the supplied map
function to convert each element from the input stream into a num
(i.e. either an int
or a double
).
If a map
function is not specified then the identity function is used.
If the closeOnError
flag is set to true, then any error in the map
function will complete the Future
with the error. Otherwise, any errors will be swallowed and excluded from the final sum.