| Define Streams in Scala with and example?
To define Streams in scala we use Lazy list to define streams in scala. Its a lazy list which is evaluates the elements when we need that. And this types of lazy computation enhances the performance of the program. Below is the example of Streams in Scala.
scala> val stream=12#::14#::16#::Stream.empty
stream: scala.collection.immutable.Stream[int] = Stream(12, ?)
as in above code we donot need second element so we have not evaluate the second element | | |