StreamHasToScala

scala.collection.convert.StreamExtensions.StreamHasToScala
implicit class StreamHasToScala[A](stream: Stream[A])

Attributes

Source
StreamExtensions.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def asJavaPrimitiveStream[S](implicit unboxer: StreamUnboxer[A, S]): S

Converts a generic Java Stream wrapping a primitive type to a corresponding primitive Stream.

Converts a generic Java Stream wrapping a primitive type to a corresponding primitive Stream.

Type parameters

S

the resulting primitive stream type (e.g., IntStream, LongStream, DoubleStream)

Value parameters

unboxer

implicit conversion from boxed Stream[A] to primitive stream S

Attributes

Returns

a primitive Java Stream of type S containing the unboxed elements of this stream

Source
StreamExtensions.scala
def toScala[C1](factory: Factory[A, C1])(implicit info: AccumulatorFactoryInfo[A, C1]): C1

Copies the elements of this stream into a Scala collection.

Copies the elements of this stream into a Scala collection.

Converting a parallel streams to an scala.jdk.Accumulator using stream.toScala(Accumulator) builds the result in parallel.

A toScala(Accumulator) call automatically converts streams of boxed integers, longs or doubles are converted to the primitive accumulators (scala.jdk.IntAccumulator, etc.).

When converting a parallel stream to a different Scala collection, the stream is first converted into an scala.jdk.Accumulator, which supports parallel building. The accumulator is then converted to the target collection. Note that the stream is processed eagerly while building the accumulator, even if the target collection is lazy.

Sequential streams are directly converted to the target collection. If the target collection is lazy, the conversion is lazy as well.

Type parameters

C1

the type of the target Scala collection

Value parameters

factory

the factory used to build the target collection

info

implicit evidence connecting the element type to a specialized Accumulator, or a generic fallback (resolved automatically)

Attributes

Returns

the elements of this stream collected into a Scala collection of type C1

Source
StreamExtensions.scala