Stream represents a sequence of values. Stream API, introduced in JAVA 8 (JSR-355 [1]) enables declarative specification of computation on data. It may also interesting to note that it imposes no restriction on
Yay! Finally, I have received the certificate of Functional Programming Principles in Scala course. Thanks @coursera! It has been a great pleasure, and I look forward to the future courses (e.g., Discrete
Yay! Just finished Functional Programming Principles in Scala (with 100% score :D) instructed by Prof. Martin Odersky et al, at Coursera. It has been an excellent experience due to its great content, amazing
Given a set represented as a String, we can compute its powerset using foldLeft, as shown below.
def powerset(s: String) =
s.foldLeft(Set("")) {
case (acc, x) => acc ++ acc.map(
This post discusses a O(n) algorithm that construct a balanced binary search tree (BST) from a sorted list. For instance, consider that we are given a sorted list: [1,2,3,4,