public static class StreamExtensions.IntStreamHasToScala
extends java.lang.Object
Constructor and Description |
---|
IntStreamHasToScala(java.util.stream.IntStream stream) |
Modifier and Type | Method and Description |
---|---|
scala.jdk.IntAccumulator |
accumulate() |
<CC> CC |
toScala(scala.collection.Factory<java.lang.Object,CC> factory)
Copy the elements of this stream into a Scala collection.
|
<C> C |
toScalaFactory(scala.collection.Factory<java.lang.Object,C> factory,
scala.collection.convert.StreamExtensions.AccumulatorFactoryInfo<java.lang.Object,C> info)
Copy the elements of this stream into a Scala collection.
|
public IntStreamHasToScala(java.util.stream.IntStream stream)
public scala.jdk.IntAccumulator accumulate()
public <CC> CC toScala(scala.collection.Factory<java.lang.Object,CC> factory)
For parallel streams, using accumulate
is recommended as it builds the IntAccumulator
in parallel.
When converting a parallel stream to a different Scala collection, the stream is first
converted into an 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.
factory
- (undocumented)public <C> C toScalaFactory(scala.collection.Factory<java.lang.Object,C> factory, scala.collection.convert.StreamExtensions.AccumulatorFactoryInfo<java.lang.Object,C> info)
Converting a parallel streams to an Accumulator
using stream.toScalaFactory(Accumulator)
builds the result in parallel.
A toScalaFactory(Accumulator)
call automatically converts the IntStream
to a primitive
IntAccumulator
.
When converting a parallel stream to a different Scala collection, the stream is first
converted into an 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.
factory
- (undocumented)info
- (undocumented)