@@ -53,7 +53,7 @@ trait EfficientSubstep {}
53
53
54
54
/** Provides functionality for Stepper while keeping track of a more precise type of the collection.
55
55
*/
56
- trait StepperLike [@ specialized(Double , Int , Long ) A , + CC ] { self =>
56
+ trait StepperLike [@ specialized(Double , Int , Long ) A , + CC ] { self : CC =>
57
57
/** Characteristics are bit flags that indicate runtime characteristics of this Stepper.
58
58
*
59
59
* - `Distinct` means that no duplicates exist
@@ -90,9 +90,6 @@ trait StepperLike[@specialized(Double, Int, Long) A, +CC] { self =>
90
90
*/
91
91
def substep (): CC
92
92
93
- /** Returns the precise underlying type of this `Stepper`. */
94
- def typedPrecisely : CC
95
-
96
93
/** Warns this `Stepper` that it is likely to be used in a parallel context (used for efficiency only) */
97
94
def anticipateParallelism : this .type = this
98
95
@@ -236,8 +233,7 @@ trait AnyStepper[A] extends Stepper[A] with java.util.Iterator[A] with Spliterat
236
233
def nextStep = next
237
234
def tryAdvance (c : java.util.function.Consumer [_ >: A ]): Boolean = if (hasNext) { c.accept(next); true } else false
238
235
def tryStep (f : A => Unit ): Boolean = if (hasNext) { f(next); true } else false
239
- def trySplit () = substep match { case null => null ; case x => x.typedPrecisely }
240
- final def typedPrecisely : AnyStepper [A ] = this
236
+ def trySplit () = substep
241
237
override def spliterator : Spliterator [A ] = this
242
238
def seqStream : java.util.stream.Stream [A ] = java.util.stream.StreamSupport .stream(this , false )
243
239
def parStream : java.util.stream.Stream [A ] = java.util.stream.StreamSupport .stream(this , true )
@@ -253,8 +249,7 @@ trait DoubleStepper extends Stepper[Double] with java.util.PrimitiveIterator.OfD
253
249
def tryAdvance (c : java.util.function.Consumer [_ >: java.lang.Double ]): Boolean = if (hasNext) { c.accept(java.lang.Double .valueOf(nextDouble)); true } else false
254
250
def tryAdvance (c : java.util.function.DoubleConsumer ): Boolean = if (hasNext) { c.accept(nextDouble); true } else false
255
251
def tryStep (f : Double => Unit ): Boolean = if (hasNext) { f(nextDouble); true } else false
256
- def trySplit () = substep match { case null => null ; case x => x.typedPrecisely }
257
- final def typedPrecisely : DoubleStepper = this
252
+ def trySplit () = substep
258
253
override def spliterator : Spliterator [Double ] = this .asInstanceOf [Spliterator [Double ]] // Scala and Java disagree about whether it's java.lang.Double or double
259
254
def seqStream : java.util.stream.DoubleStream = java.util.stream.StreamSupport .doubleStream(this , false )
260
255
def parStream : java.util.stream.DoubleStream = java.util.stream.StreamSupport .doubleStream(this , true )
@@ -270,8 +265,7 @@ trait IntStepper extends Stepper[Int] with java.util.PrimitiveIterator.OfInt wit
270
265
def tryAdvance (c : java.util.function.Consumer [_ >: java.lang.Integer ]): Boolean = if (hasNext) { c.accept(java.lang.Integer .valueOf(nextInt)); true } else false
271
266
def tryAdvance (c : java.util.function.IntConsumer ): Boolean = if (hasNext) { c.accept(nextInt); true } else false
272
267
def tryStep (f : Int => Unit ): Boolean = if (hasNext) { f(nextInt); true } else false
273
- def trySplit () = substep match { case null => null ; case x => x.typedPrecisely }
274
- final def typedPrecisely = this
268
+ def trySplit () = substep
275
269
override def spliterator : Spliterator [Int ] = this .asInstanceOf [Spliterator [Int ]] // Scala and Java disagree about whether it's java.lang.Integer or int
276
270
def seqStream : java.util.stream.IntStream = java.util.stream.StreamSupport .intStream(this , false )
277
271
def parStream : java.util.stream.IntStream = java.util.stream.StreamSupport .intStream(this , true )
@@ -287,8 +281,7 @@ trait LongStepper extends Stepper[Long] with java.util.PrimitiveIterator.OfLong
287
281
def tryAdvance (c : java.util.function.Consumer [_ >: java.lang.Long ]): Boolean = if (hasNext) { c.accept(java.lang.Long .valueOf(nextLong)); true } else false
288
282
def tryAdvance (c : java.util.function.LongConsumer ): Boolean = if (hasNext) { c.accept(nextLong); true } else false
289
283
def tryStep (f : Long => Unit ): Boolean = if (hasNext) { f(nextLong); true } else false
290
- def trySplit () = substep match { case null => null ; case x => x.typedPrecisely }
291
- final def typedPrecisely = this
284
+ def trySplit () = substep
292
285
override def spliterator : Spliterator [Long ] = this .asInstanceOf [Spliterator [Long ]] // Scala and Java disagree about whether it's java.lang.Long or long
293
286
def seqStream : java.util.stream.LongStream = java.util.stream.StreamSupport .longStream(this , false )
294
287
def parStream : java.util.stream.LongStream = java.util.stream.StreamSupport .longStream(this , true )
0 commit comments