October 2018
Intermediate to advanced
370 pages
9h 15m
English
The reduceRight function takes a lambda expression that takes two variables and returns a result. The difference between reduce and reduceRight is that the reduce function starts iterating from index 0 and reduceRight starts from the end of the list:
result = numbers.reduceRight { i, acc -> i + acc}println("From end : add all elements of the list $result")
Read now
Unlock full access