@@ -41,12 +41,12 @@ trait StreamExtensions {
41
41
s.fromStepper(cc.stepper, par = false )
42
42
}
43
43
44
- protected type IterableOnceWithEfficientStepper [A ] = IterableOnce [A ] {
45
- def stepper [B >: A , S <: Stepper [_]](implicit shape : StepperShape [B , S ]) : S with EfficientSplit
46
- }
47
-
48
44
// Not `CC[X] <: IterableOnce[X]`, but `C` with an extra constraint, to support non-parametric classes like IntAccumulator
49
45
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
+
50
50
/** Create a parallel [[java.util.stream.Stream Java Stream ]] for this collection. If the
51
51
* collection contains primitive values, a corresponding specialized Stream is returned (e.g.,
52
52
* [[java.util.stream.IntStream `IntStream` ]]).
@@ -55,13 +55,13 @@ trait StreamExtensions {
55
55
s : StreamShape [A , S , St ],
56
56
st : StepperShape [A , St ],
57
57
@ 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 =
59
59
s.fromStepper(ev(c).stepper, par = true )
60
60
}
61
61
62
62
// maps
63
63
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 ]) {
65
65
/** Create a sequential [[java.util.stream.Stream Java Stream ]] for the keys of this map. If
66
66
* the keys are primitive values, a corresponding specialized Stream is returned (e.g.,
67
67
* [[java.util.stream.IntStream `IntStream` ]]).
@@ -85,10 +85,10 @@ trait StreamExtensions {
85
85
}
86
86
87
87
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 }
92
92
93
93
/** Create a parallel [[java.util.stream.Stream Java Stream ]] for the keys of this map. If
94
94
* the keys are primitive values, a corresponding specialized Stream is returned (e.g.,
@@ -98,7 +98,7 @@ trait StreamExtensions {
98
98
s : StreamShape [K , S , St ],
99
99
st : StepperShape [K , St ],
100
100
@ 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 =
102
102
s.fromStepper(cc.keyStepper, par = true )
103
103
104
104
/** Create a parallel [[java.util.stream.Stream Java Stream ]] for the values of this map. If
@@ -109,7 +109,7 @@ trait StreamExtensions {
109
109
s : StreamShape [V , S , St ],
110
110
st : StepperShape [V , St ],
111
111
@ 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 =
113
113
s.fromStepper(cc.valueStepper, par = true )
114
114
115
115
// 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 {
120
120
s : StreamShape [(K , V ), S , St ],
121
121
st : StepperShape [(K , V ), St ],
122
122
@ 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 =
124
124
s.fromStepper(cc.stepper, par = true )
125
125
}
126
126
0 commit comments