@@ -41,12 +41,12 @@ trait StreamExtensions {
4141 s.fromStepper(cc.stepper, par = false )
4242 }
4343
44- protected type IterableOnceWithEfficientStepper [A ] = IterableOnce [A ] {
45- def stepper [B >: A , S <: Stepper [_]](implicit shape : StepperShape [B , S ]) : S with EfficientSplit
46- }
47-
4844 // Not `CC[X] <: IterableOnce[X]`, but `C` with an extra constraint, to support non-parametric classes like IntAccumulator
4945 implicit class IterableNonGenericHasParStream [A , C <: IterableOnce [_]](c : C )(implicit ev : C <:< IterableOnce [A ]) {
46+ private type IterableOnceWithEfficientStepper = IterableOnce [A ] {
47+ def stepper [S <: Stepper [_]](implicit shape : StepperShape [A , S ]) : S with EfficientSplit
48+ }
49+
5050 /** Create a parallel [[java.util.stream.Stream Java Stream ]] for this collection. If the
5151 * collection contains primitive values, a corresponding specialized Stream is returned (e.g.,
5252 * [[java.util.stream.IntStream `IntStream` ]]).
@@ -55,13 +55,13 @@ trait StreamExtensions {
5555 s : StreamShape [A , S , St ],
5656 st : StepperShape [A , St ],
5757 @ implicitNotFound(" `parStream` can only be called on collections where `stepper` returns a `Stepper with EfficientSplit`" )
58- isEfficient : C <:< IterableOnceWithEfficientStepper [ A ] ): S =
58+ isEfficient : C <:< IterableOnceWithEfficientStepper ): S =
5959 s.fromStepper(ev(c).stepper, par = true )
6060 }
6161
6262 // maps
6363
64- implicit class MapHasSeqKeyValueStream [K , V , CC [X , Y ] <: collection.MapOps [X , Y , CC , _]](cc : CC [K , V ]) {
64+ implicit class MapHasSeqKeyValueStream [K , V , CC [X , Y ] <: collection.MapOps [X , Y , collection. Map , _]](cc : CC [K , V ]) {
6565 /** Create a sequential [[java.util.stream.Stream Java Stream ]] for the keys of this map. If
6666 * the keys are primitive values, a corresponding specialized Stream is returned (e.g.,
6767 * [[java.util.stream.IntStream `IntStream` ]]).
@@ -85,10 +85,10 @@ trait StreamExtensions {
8585 }
8686
8787
88- implicit class MapHasParKeyValueStream [K , V , CC [X , Y ] <: collection.MapOps [X , Y , CC , _]](cc : CC [K , V ]) {
89- private type MapOpsWithEfficientKeyStepper [ K , V ] = collection.MapOps [K , V , CC , _] { def keyStepper [S <: Stepper [_]](implicit shape : StepperShape [K , S ]) : S with EfficientSplit }
90- private type MapOpsWithEfficientValueStepper [ K , V ] = collection.MapOps [K , V , CC , _] { def valueStepper [V1 >: V , S <: Stepper [_]](implicit shape : StepperShape [V1 , S ]) : S with EfficientSplit }
91- private type MapOpsWithEfficientStepper [ K , V ] = collection.MapOps [K , V , CC , _] { def stepper [B >: ( K , V ), S <: Stepper [_]](implicit shape : StepperShape [B , S ]) : S with EfficientSplit }
88+ implicit class MapHasParKeyValueStream [K , V , CC [X , Y ] <: collection.MapOps [X , Y , collection. Map , _]](cc : CC [K , V ]) {
89+ private type MapOpsWithEfficientKeyStepper = collection.MapOps [K , V , collection. Map , _] { def keyStepper [S <: Stepper [_]](implicit shape : StepperShape [K , S ]) : S with EfficientSplit }
90+ private type MapOpsWithEfficientValueStepper = collection.MapOps [K , V , collection. Map , _] { def valueStepper [V1 >: V , S <: Stepper [_]](implicit shape : StepperShape [V1 , S ]) : S with EfficientSplit }
91+ private type MapOpsWithEfficientStepper = collection.MapOps [K , V , collection. Map , _] { def stepper [S <: Stepper [_]](implicit shape : StepperShape [( K , V ) , S ]) : S with EfficientSplit }
9292
9393 /** Create a parallel [[java.util.stream.Stream Java Stream ]] for the keys of this map. If
9494 * the keys are primitive values, a corresponding specialized Stream is returned (e.g.,
@@ -98,7 +98,7 @@ trait StreamExtensions {
9898 s : StreamShape [K , S , St ],
9999 st : StepperShape [K , St ],
100100 @ implicitNotFound(" parKeyStream can only be called on maps where `keyStepper` returns a `Stepper with EfficientSplit`" )
101- isEfficient : CC [K , V ] <:< MapOpsWithEfficientKeyStepper [ K , V ] ): S =
101+ isEfficient : CC [K , V ] <:< MapOpsWithEfficientKeyStepper ): S =
102102 s.fromStepper(cc.keyStepper, par = true )
103103
104104 /** Create a parallel [[java.util.stream.Stream Java Stream ]] for the values of this map. If
@@ -109,7 +109,7 @@ trait StreamExtensions {
109109 s : StreamShape [V , S , St ],
110110 st : StepperShape [V , St ],
111111 @ implicitNotFound(" parValueStream can only be called on maps where `valueStepper` returns a `Stepper with EfficientSplit`" )
112- isEfficient : CC [K , V ] <:< MapOpsWithEfficientValueStepper [ K , V ] ): S =
112+ isEfficient : CC [K , V ] <:< MapOpsWithEfficientValueStepper ): S =
113113 s.fromStepper(cc.valueStepper, par = true )
114114
115115 // The parStream extension method for IterableOnce doesn't apply because its `CC` takes a single type parameter, whereas the one here takes two
@@ -120,7 +120,7 @@ trait StreamExtensions {
120120 s : StreamShape [(K , V ), S , St ],
121121 st : StepperShape [(K , V ), St ],
122122 @ implicitNotFound(" parStream can only be called on maps where `stepper` returns a `Stepper with EfficientSplit`" )
123- isEfficient : CC [K , V ] <:< MapOpsWithEfficientStepper [ K , V ] ): S =
123+ isEfficient : CC [K , V ] <:< MapOpsWithEfficientStepper ): S =
124124 s.fromStepper(cc.stepper, par = true )
125125 }
126126
0 commit comments