Scala Extension

How To Use

In order to start using Stream with Scala and Java collections the Stream.Enable object must be imported:

import scalqa.Stream.Enable._

From this point, every collection gets a new implicit method all, which explicitly creates Stream of all elements

def ints: ~[Int]   = List(1,2,3).all

def chars: ~[Char] = Seq('a','b','c').all


Why To Use

Stream processing is extremely efficient

If one always types .all before doing any data transformations, the program in general will run faster, while using less memory

Consider a List holding a 1000 integers. Suppose, we need to filter 'even' values and convert result to Array

val list = (1 to 1000).toList

val a1 = list.filter(_ % 2 == 0).toArray
val a2 = list.all.filter(_ % 2 == 0).toArray

The second (Stream based) option is twice as fast and uses half the memory

See Performance section for more examples