@@ -14,7 +14,8 @@ trait PrimitiveStreamUnboxer[A, S] {
1414 def apply (boxed : Stream [A ]): S
1515}
1616
17- trait Priority3StreamConverters {
17+ trait Priority4StreamConverters {
18+ // Fallback converters for AnySteppers that cannot be unboxed and widened to primitive streams
1819 implicit class EnrichAnySteppableWithParStream [A , CC ](cc : CC )(implicit steppize : CC => MakesStepper [AnyStepper [A ] with EfficientSubstep ])
1920 extends MakesParallelStream [A , Stream [A ]] {
2021 def parStream : Stream [A ] = StreamSupport .stream(steppize(cc).stepper.anticipateParallelism, true )
@@ -25,7 +26,6 @@ trait Priority3StreamConverters {
2526 implicit class EnrichAnyValueSteppableWithParValueStream [V , CC ](cc : CC )(implicit steppize : CC => MakesValueStepper [AnyStepper [V ] with EfficientSubstep ]) {
2627 def parValueStream : Stream [V ] = StreamSupport .stream(steppize(cc).valueStepper.anticipateParallelism, true )
2728 }
28- // Note--conversion is only to make sure implicit conversion priority is lower than alternatives.
2929 implicit class EnrichScalaCollectionWithSeqStream [A , CC ](cc : CC )(implicit steppize : CC => MakesStepper [AnyStepper [A ]])
3030 extends MakesSequentialStream [A , Stream [A ]] {
3131 def seqStream : Stream [A ] = StreamSupport .stream(steppize(cc).stepper, false )
@@ -38,6 +38,90 @@ trait Priority3StreamConverters {
3838 }
3939}
4040
41+ trait Priority3StreamConverters extends Priority4StreamConverters {
42+ // Prefer to unbox and widen small primitive types over keeping them boxed
43+ implicit class EnrichBoxedFloatSteppableWithParStream [CC ](cc : CC )(implicit steppize : CC => MakesStepper [AnyStepper [Float ] with EfficientSubstep ])
44+ extends MakesParallelStream [java.lang.Double , DoubleStream ] {
45+ def parStream : DoubleStream = StreamSupport .doubleStream(new Stepper .WideningFloatStepper (steppize(cc).stepper.anticipateParallelism), true )
46+ }
47+ implicit class EnrichBoxedFloatKeySteppableWithParKeyStream [CC ](cc : CC )(implicit steppize : CC => MakesKeyStepper [AnyStepper [Float ] with EfficientSubstep ]) {
48+ def parKeyStream : DoubleStream = StreamSupport .doubleStream(new Stepper .WideningFloatStepper (steppize(cc).keyStepper.anticipateParallelism), true )
49+ }
50+ implicit class EnrichBoxedFloatValueSteppableWithParValueStream [CC ](cc : CC )(implicit steppize : CC => MakesValueStepper [AnyStepper [Float ] with EfficientSubstep ]) {
51+ def parValueStream : DoubleStream = StreamSupport .doubleStream(new Stepper .WideningFloatStepper (steppize(cc).valueStepper.anticipateParallelism), true )
52+ }
53+ implicit class EnrichBoxedByteSteppableWithParStream [CC ](cc : CC )(implicit steppize : CC => MakesStepper [AnyStepper [Byte ] with EfficientSubstep ])
54+ extends MakesParallelStream [java.lang.Integer , IntStream ] {
55+ def parStream : IntStream = StreamSupport .intStream(new Stepper .WideningByteStepper (steppize(cc).stepper.anticipateParallelism), true )
56+ }
57+ implicit class EnrichBoxedByteKeySteppableWithParKeyStream [CC ](cc : CC )(implicit steppize : CC => MakesKeyStepper [AnyStepper [Byte ] with EfficientSubstep ]) {
58+ def parKeyStream : IntStream = StreamSupport .intStream(new Stepper .WideningByteStepper (steppize(cc).keyStepper.anticipateParallelism), true )
59+ }
60+ implicit class EnrichBoxedByteValueSteppableWithParValueStream [CC ](cc : CC )(implicit steppize : CC => MakesValueStepper [AnyStepper [Byte ] with EfficientSubstep ]) {
61+ def parValueStream : IntStream = StreamSupport .intStream(new Stepper .WideningByteStepper (steppize(cc).valueStepper.anticipateParallelism), true )
62+ }
63+ implicit class EnrichBoxedShortSteppableWithParStream [CC ](cc : CC )(implicit steppize : CC => MakesStepper [AnyStepper [Short ] with EfficientSubstep ])
64+ extends MakesParallelStream [java.lang.Integer , IntStream ] {
65+ def parStream : IntStream = StreamSupport .intStream(new Stepper .WideningShortStepper (steppize(cc).stepper.anticipateParallelism), true )
66+ }
67+ implicit class EnrichBoxedShortKeySteppableWithParKeyStream [CC ](cc : CC )(implicit steppize : CC => MakesKeyStepper [AnyStepper [Short ] with EfficientSubstep ]) {
68+ def parKeyStream : IntStream = StreamSupport .intStream(new Stepper .WideningShortStepper (steppize(cc).keyStepper.anticipateParallelism), true )
69+ }
70+ implicit class EnrichBoxedShortValueSteppableWithParValueStream [CC ](cc : CC )(implicit steppize : CC => MakesValueStepper [AnyStepper [Short ] with EfficientSubstep ]) {
71+ def parValueStream : IntStream = StreamSupport .intStream(new Stepper .WideningShortStepper (steppize(cc).valueStepper.anticipateParallelism), true )
72+ }
73+ implicit class EnrichBoxedCharSteppableWithParStream [CC ](cc : CC )(implicit steppize : CC => MakesStepper [AnyStepper [Char ] with EfficientSubstep ])
74+ extends MakesParallelStream [java.lang.Integer , IntStream ] {
75+ def parStream : IntStream = StreamSupport .intStream(new Stepper .WideningCharStepper (steppize(cc).stepper.anticipateParallelism), true )
76+ }
77+ implicit class EnrichBoxedCharKeySteppableWithParKeyStream [CC ](cc : CC )(implicit steppize : CC => MakesKeyStepper [AnyStepper [Char ] with EfficientSubstep ]) {
78+ def parKeyStream : IntStream = StreamSupport .intStream(new Stepper .WideningCharStepper (steppize(cc).keyStepper.anticipateParallelism), true )
79+ }
80+ implicit class EnrichBoxedCharValueSteppableWithParValueStream [CC ](cc : CC )(implicit steppize : CC => MakesValueStepper [AnyStepper [Char ] with EfficientSubstep ]) {
81+ def parValueStream : IntStream = StreamSupport .intStream(new Stepper .WideningCharStepper (steppize(cc).valueStepper.anticipateParallelism), true )
82+ }
83+ implicit class EnrichBoxedFloatSteppableWithSeqStream [CC ](cc : CC )(implicit steppize : CC => MakesStepper [AnyStepper [Float ]])
84+ extends MakesSequentialStream [java.lang.Double , DoubleStream ] {
85+ def seqStream : DoubleStream = StreamSupport .doubleStream(new Stepper .WideningFloatStepper (steppize(cc).stepper), false )
86+ }
87+ implicit class EnrichBoxedFloatKeySteppableWithSeqKeyStream [CC ](cc : CC )(implicit steppize : CC => MakesKeyStepper [AnyStepper [Float ]]) {
88+ def seqKeyStream : DoubleStream = StreamSupport .doubleStream(new Stepper .WideningFloatStepper (steppize(cc).keyStepper), false )
89+ }
90+ implicit class EnrichBoxedFloatValueSteppableWithSeqValueStream [CC ](cc : CC )(implicit steppize : CC => MakesValueStepper [AnyStepper [Float ]]) {
91+ def seqValueStream : DoubleStream = StreamSupport .doubleStream(new Stepper .WideningFloatStepper (steppize(cc).valueStepper), false )
92+ }
93+ implicit class EnrichBoxedByteSteppableWithSeqStream [CC ](cc : CC )(implicit steppize : CC => MakesStepper [AnyStepper [Byte ]])
94+ extends MakesSequentialStream [java.lang.Integer , IntStream ] {
95+ def seqStream : IntStream = StreamSupport .intStream(new Stepper .WideningByteStepper (steppize(cc).stepper), false )
96+ }
97+ implicit class EnrichBoxedByteKeySteppableWithSeqKeyStream [CC ](cc : CC )(implicit steppize : CC => MakesKeyStepper [AnyStepper [Byte ]]) {
98+ def seqKeyStream : IntStream = StreamSupport .intStream(new Stepper .WideningByteStepper (steppize(cc).keyStepper), false )
99+ }
100+ implicit class EnrichBoxedByteValueSteppableWithSeqValueStream [CC ](cc : CC )(implicit steppize : CC => MakesValueStepper [AnyStepper [Byte ]]) {
101+ def seqValueStream : IntStream = StreamSupport .intStream(new Stepper .WideningByteStepper (steppize(cc).valueStepper), false )
102+ }
103+ implicit class EnrichBoxedShortSteppableWithSeqStream [CC ](cc : CC )(implicit steppize : CC => MakesStepper [AnyStepper [Short ]])
104+ extends MakesSequentialStream [java.lang.Integer , IntStream ] {
105+ def seqStream : IntStream = StreamSupport .intStream(new Stepper .WideningShortStepper (steppize(cc).stepper), false )
106+ }
107+ implicit class EnrichBoxedShortKeySteppableWithSeqKeyStream [CC ](cc : CC )(implicit steppize : CC => MakesKeyStepper [AnyStepper [Short ]]) {
108+ def seqKeyStream : IntStream = StreamSupport .intStream(new Stepper .WideningShortStepper (steppize(cc).keyStepper), false )
109+ }
110+ implicit class EnrichBoxedShortValueSteppableWithSeqValueStream [CC ](cc : CC )(implicit steppize : CC => MakesValueStepper [AnyStepper [Short ]]) {
111+ def seqValueStream : IntStream = StreamSupport .intStream(new Stepper .WideningShortStepper (steppize(cc).valueStepper), false )
112+ }
113+ implicit class EnrichBoxedCharSteppableWithSeqStream [CC ](cc : CC )(implicit steppize : CC => MakesStepper [AnyStepper [Char ]])
114+ extends MakesSequentialStream [java.lang.Integer , IntStream ] {
115+ def seqStream : IntStream = StreamSupport .intStream(new Stepper .WideningCharStepper (steppize(cc).stepper), false )
116+ }
117+ implicit class EnrichBoxedCharKeySteppableWithSeqKeyStream [CC ](cc : CC )(implicit steppize : CC => MakesKeyStepper [AnyStepper [Char ]]) {
118+ def seqKeyStream : IntStream = StreamSupport .intStream(new Stepper .WideningCharStepper (steppize(cc).keyStepper), false )
119+ }
120+ implicit class EnrichBoxedCharValueSteppableWithSeqValueStream [CC ](cc : CC )(implicit steppize : CC => MakesValueStepper [AnyStepper [Char ]]) {
121+ def seqValueStream : IntStream = StreamSupport .intStream(new Stepper .WideningCharStepper (steppize(cc).valueStepper), false )
122+ }
123+ }
124+
41125trait Priority2StreamConverters extends Priority3StreamConverters {
42126 implicit class EnrichDoubleSteppableWithParStream [CC ](cc : CC )(implicit steppize : CC => MakesStepper [DoubleStepper with EfficientSubstep ])
43127 extends MakesParallelStream [java.lang.Double , DoubleStream ] {
0 commit comments