_toCollections
- Source
- _toCollections.scala
Def
Convert to Array
Convert to Array
Returns stream elements as Array
val a : Array[Int] = (1 <> 10).stream.toArray
- Source
- _toCollections.scala
Convert to Lookup
Convert to Lookup
Note. This operation is only available for streams holding tuples, like (KEY,VALUE)
Converts a stream of tuples to Lookup
val intLookup : Lookup[Int,Char] = ('A' <> 'F').stream.zipKey(_.toInt).toLookup
intLookup.pairStream.tp // Prints Stream((69,E), (70,F), (65,A), (66,B), (67,C), (68,D))
val charLookup : Lookup[Char,Int] = ('A' <> 'F').stream.zipValue(_.toInt).toLookup
charLookup.pairStream.tp // Prints Stream((E,69), (F,70), (A,65), (B,66), (C,67), (D,68))
- Source
- _toCollections.scala
Convert to Lookup
Convert to Lookup
Converts stream to a Lookup collection, where key is created with provided function
val intLookup : Lookup[Int,Char] = ('A' <> 'F').stream.toLookupBy(_.toInt)
intLookup.pairStream.tp // Prints Stream((69,E), (70,F), (65,A), (66,B), (67,C), (68,D))
- Source
- _toCollections.scala
Convert to unique collection
Convert to unique collection
Returns stream elements as Set
- Source
- _toCollections.scala