_toCollections

trait _toCollections[A]
class java.lang.Object
trait scala.Matchable
class Any
trait _use
object Stream

Def

inline def pack(using s: Specialized[A]): s.Pack

Pack elements

Pack elements

Returns stream elements as Pack

Source
_toCollections.scala
inline def toArray(using t: scala.reflect.ClassTag[A], s: Specialized[A]): s.Array

Convert to Array

Convert to Array

Returns stream elements as Array

 val a : Array[Int] =  (1 <> 10).stream.toArray
Source
_toCollections.scala
inline def toBuffer(using s: Specialized[A]): s.Buffer

Convert to Buffer

Convert to Buffer

Returns stream elements as Buffer

Source
_toCollections.scala
inline def toIdx(using s: Specialized[A]): s.Idx

Convert to Idx

Convert to Idx

Returns stream elements as Idx

Source
_toCollections.scala
inline def toLookup[KEY, VALUE](using KEY: Specialized[KEY]): KEY.Lookup[VALUE]

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
inline def toLookupBy[KEY](f: A => KEY)(using KEY: Specialized[KEY]): KEY.Lookup[A]

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
inline def toSet(using s: Specialized[A]): s.Set

Convert to unique collection

Convert to unique collection

Returns stream elements as Set

Source
_toCollections.scala