@@ -93,59 +93,82 @@ public static int bufferSize() {
93
93
return BUFFER_SIZE ;
94
94
}
95
95
96
- @ BackpressureSupport (BackpressureKind .FULL )
97
96
@ SchedulerSupport (SchedulerSupport .NONE )
98
- public static <T , R > Flowable <R > combineLatest (Function <? super Object [], ? extends R > combiner , boolean delayError , int bufferSize , Publisher <? extends T >... sources ) {
99
- return combineLatest (sources , combiner , delayError , bufferSize );
97
+ @ BackpressureSupport (BackpressureKind .FULL )
98
+ public static <T , R > Flowable <R > combineLatest (Publisher <? extends T >[] sources , Function <Object [], ? extends R > combiner ) {
99
+ return combineLatest (sources , combiner , bufferSize ());
100
100
}
101
101
102
- @ BackpressureSupport (BackpressureKind .FULL )
103
102
@ SchedulerSupport (SchedulerSupport .NONE )
104
- public static <T , R > Flowable <R > combineLatest (Iterable <? extends Publisher <? extends T >> sources , Function <? super Object [], ? extends R > combiner ) {
105
- return combineLatest (sources , combiner , false , bufferSize ());
103
+ @ BackpressureSupport (BackpressureKind .FULL )
104
+ public static <T , R > Flowable <R > combineLatest (Function <Object [], ? extends R > combiner , Publisher <? extends T >... sources ) {
105
+ return combineLatest (sources , combiner , bufferSize ());
106
106
}
107
107
108
- @ BackpressureSupport (BackpressureKind .FULL )
109
108
@ SchedulerSupport (SchedulerSupport .NONE )
110
- public static <T , R > Flowable <R > combineLatest (Iterable <? extends Publisher <? extends T >> sources , Function <? super Object [], ? extends R > combiner , boolean delayError ) {
111
- return combineLatest (sources , combiner , delayError , bufferSize ());
109
+ @ BackpressureSupport (BackpressureKind .FULL )
110
+ public static <T , R > Flowable <R > combineLatest (Publisher <? extends T >[] sources , Function <Object [], ? extends R > combiner , int bufferSize ) {
111
+ Objects .requireNonNull (sources , "sources is null" );
112
+ Objects .requireNonNull (combiner , "combiner is null" );
113
+ validateBufferSize (bufferSize );
114
+ if (sources .length == 0 ) {
115
+ return empty ();
116
+ }
117
+ return new FlowableCombineLatest <T , R >(sources , combiner , bufferSize , false );
112
118
}
113
119
120
+ @ SchedulerSupport (SchedulerSupport .NONE )
114
121
@ BackpressureSupport (BackpressureKind .FULL )
122
+ public static <T , R > Flowable <R > combineLatest (Iterable <? extends Publisher <? extends T >> sources , Function <Object [], ? extends R > combiner ) {
123
+ return combineLatest (sources , combiner , bufferSize ());
124
+ }
125
+
115
126
@ SchedulerSupport (SchedulerSupport .NONE )
116
- public static <T , R > Flowable <R > combineLatest (Iterable <? extends Publisher <? extends T >> sources , Function <? super Object [], ? extends R > combiner , boolean delayError , int bufferSize ) {
127
+ @ BackpressureSupport (BackpressureKind .FULL )
128
+ public static <T , R > Flowable <R > combineLatest (Iterable <? extends Publisher <? extends T >> sources , Function <Object [], ? extends R > combiner , int bufferSize ) {
117
129
Objects .requireNonNull (sources , "sources is null" );
118
130
Objects .requireNonNull (combiner , "combiner is null" );
119
131
validateBufferSize (bufferSize );
120
-
121
- // the queue holds a pair of values so we need to double the capacity
122
- int s = bufferSize << 1 ;
123
- return new FlowableCombineLatest <T , R >(null , sources , combiner , s , delayError );
132
+ return new FlowableCombineLatest <T , R >(sources , combiner , bufferSize , false );
124
133
}
125
134
126
- @ BackpressureSupport (BackpressureKind .FULL )
127
135
@ SchedulerSupport (SchedulerSupport .NONE )
128
- public static <T , R > Flowable <R > combineLatest (Publisher <? extends T >[] sources , Function <? super Object [], ? extends R > combiner ) {
129
- return combineLatest (sources , combiner , false , bufferSize ());
136
+ @ BackpressureSupport (BackpressureKind .FULL )
137
+ public static <T , R > Flowable <R > combineLatestDelayError (Publisher <? extends T >[] sources , Function <Object [], ? extends R > combiner ) {
138
+ return combineLatestDelayError (sources , combiner , bufferSize ());
130
139
}
131
140
132
- @ BackpressureSupport (BackpressureKind .FULL )
133
141
@ SchedulerSupport (SchedulerSupport .NONE )
134
- public static <T , R > Flowable <R > combineLatest (Publisher <? extends T >[] sources , Function <? super Object [], ? extends R > combiner , boolean delayError ) {
135
- return combineLatest (sources , combiner , delayError , bufferSize ());
142
+ @ BackpressureSupport (BackpressureKind .FULL )
143
+ public static <T , R > Flowable <R > combineLatestDelayError (Function <Object [], ? extends R > combiner , Publisher <? extends T >... sources ) {
144
+ return combineLatestDelayError (sources , combiner , bufferSize ());
136
145
}
137
146
138
- @ BackpressureSupport (BackpressureKind .FULL )
139
147
@ SchedulerSupport (SchedulerSupport .NONE )
140
- public static <T , R > Flowable <R > combineLatest (Publisher <? extends T >[] sources , Function <? super Object [], ? extends R > combiner , boolean delayError , int bufferSize ) {
141
- validateBufferSize (bufferSize );
148
+ @ BackpressureSupport (BackpressureKind .FULL )
149
+ public static <T , R > Flowable <R > combineLatestDelayError (Publisher <? extends T >[] sources , Function <Object [], ? extends R > combiner , int bufferSize ) {
150
+ Objects .requireNonNull (sources , "sources is null" );
142
151
Objects .requireNonNull (combiner , "combiner is null" );
152
+ validateBufferSize (bufferSize );
143
153
if (sources .length == 0 ) {
144
154
return empty ();
145
155
}
146
- // the queue holds a pair of values so we need to double the capacity
147
- int s = bufferSize << 1 ;
148
- return new FlowableCombineLatest <T , R >(sources , null , combiner , s , delayError );
156
+ return new FlowableCombineLatest <T , R >(sources , combiner , bufferSize , true );
157
+ }
158
+
159
+ @ SchedulerSupport (SchedulerSupport .NONE )
160
+ @ BackpressureSupport (BackpressureKind .FULL )
161
+ public static <T , R > Flowable <R > combineLatestDelayError (Iterable <? extends Publisher <? extends T >> sources , Function <Object [], ? extends R > combiner ) {
162
+ return combineLatestDelayError (sources , combiner , bufferSize ());
163
+ }
164
+
165
+ @ SchedulerSupport (SchedulerSupport .NONE )
166
+ @ BackpressureSupport (BackpressureKind .FULL )
167
+ public static <T , R > Flowable <R > combineLatestDelayError (Iterable <? extends Publisher <? extends T >> sources , Function <Object [], ? extends R > combiner , int bufferSize ) {
168
+ Objects .requireNonNull (sources , "sources is null" );
169
+ Objects .requireNonNull (combiner , "combiner is null" );
170
+ validateBufferSize (bufferSize );
171
+ return new FlowableCombineLatest <T , R >(sources , combiner , bufferSize , true );
149
172
}
150
173
151
174
@ SuppressWarnings ("unchecked" )
@@ -155,7 +178,7 @@ public static <T1, T2, R> Flowable<R> combineLatest(
155
178
Publisher <? extends T1 > p1 , Publisher <? extends T2 > p2 ,
156
179
BiFunction <? super T1 , ? super T2 , ? extends R > combiner ) {
157
180
Function <Object [], R > f = Functions .toFunction (combiner );
158
- return combineLatest (f , false , bufferSize (), p1 , p2 );
181
+ return combineLatest (f , p1 , p2 );
159
182
}
160
183
161
184
@ SuppressWarnings ("unchecked" )
@@ -165,7 +188,7 @@ public static <T1, T2, T3, R> Flowable<R> combineLatest(
165
188
Publisher <? extends T1 > p1 , Publisher <? extends T2 > p2 ,
166
189
Publisher <? extends T3 > p3 ,
167
190
Function3 <? super T1 , ? super T2 , ? super T3 , ? extends R > combiner ) {
168
- return combineLatest (Functions .toFunction (combiner ), false , bufferSize (), p1 , p2 , p3 );
191
+ return combineLatest (Functions .toFunction (combiner ), p1 , p2 , p3 );
169
192
}
170
193
171
194
@ SuppressWarnings ("unchecked" )
@@ -175,7 +198,7 @@ public static <T1, T2, T3, T4, R> Flowable<R> combineLatest(
175
198
Publisher <? extends T1 > p1 , Publisher <? extends T2 > p2 ,
176
199
Publisher <? extends T3 > p3 , Publisher <? extends T4 > p4 ,
177
200
Function4 <? super T1 , ? super T2 , ? super T3 , ? super T4 , ? extends R > combiner ) {
178
- return combineLatest (Functions .toFunction (combiner ), false , bufferSize (), p1 , p2 , p3 , p4 );
201
+ return combineLatest (Functions .toFunction (combiner ), p1 , p2 , p3 , p4 );
179
202
}
180
203
181
204
@ SuppressWarnings ("unchecked" )
@@ -186,7 +209,7 @@ public static <T1, T2, T3, T4, T5, R> Flowable<R> combineLatest(
186
209
Publisher <? extends T3 > p3 , Publisher <? extends T4 > p4 ,
187
210
Publisher <? extends T5 > p5 ,
188
211
Function5 <? super T1 , ? super T2 , ? super T3 , ? super T4 , ? super T5 , ? extends R > combiner ) {
189
- return combineLatest (Functions .toFunction (combiner ), false , bufferSize (), p1 , p2 , p3 , p4 , p5 );
212
+ return combineLatest (Functions .toFunction (combiner ), p1 , p2 , p3 , p4 , p5 );
190
213
}
191
214
192
215
@ SuppressWarnings ("unchecked" )
@@ -197,7 +220,7 @@ public static <T1, T2, T3, T4, T5, T6, R> Flowable<R> combineLatest(
197
220
Publisher <? extends T3 > p3 , Publisher <? extends T4 > p4 ,
198
221
Publisher <? extends T5 > p5 , Publisher <? extends T6 > p6 ,
199
222
Function6 <? super T1 , ? super T2 , ? super T3 , ? super T4 , ? super T5 , ? super T6 , ? extends R > combiner ) {
200
- return combineLatest (Functions .toFunction (combiner ), false , bufferSize (), p1 , p2 , p3 , p4 , p5 , p6 );
223
+ return combineLatest (Functions .toFunction (combiner ), p1 , p2 , p3 , p4 , p5 , p6 );
201
224
}
202
225
203
226
@ SuppressWarnings ("unchecked" )
@@ -209,7 +232,7 @@ public static <T1, T2, T3, T4, T5, T6, T7, R> Flowable<R> combineLatest(
209
232
Publisher <? extends T5 > p5 , Publisher <? extends T6 > p6 ,
210
233
Publisher <? extends T7 > p7 ,
211
234
Function7 <? super T1 , ? super T2 , ? super T3 , ? super T4 , ? super T5 , ? super T6 , ? super T7 , ? extends R > combiner ) {
212
- return combineLatest (Functions .toFunction (combiner ), false , bufferSize (), p1 , p2 , p3 , p4 , p5 , p6 , p7 );
235
+ return combineLatest (Functions .toFunction (combiner ), p1 , p2 , p3 , p4 , p5 , p6 , p7 );
213
236
}
214
237
215
238
@ SuppressWarnings ("unchecked" )
@@ -221,7 +244,7 @@ public static <T1, T2, T3, T4, T5, T6, T7, T8, R> Flowable<R> combineLatest(
221
244
Publisher <? extends T5 > p5 , Publisher <? extends T6 > p6 ,
222
245
Publisher <? extends T7 > p7 , Publisher <? extends T8 > p8 ,
223
246
Function8 <? super T1 , ? super T2 , ? super T3 , ? super T4 , ? super T5 , ? super T6 , ? super T7 , ? super T8 , ? extends R > combiner ) {
224
- return combineLatest (Functions .toFunction (combiner ), false , bufferSize (), p1 , p2 , p3 , p4 , p5 , p6 , p7 , p8 );
247
+ return combineLatest (Functions .toFunction (combiner ), p1 , p2 , p3 , p4 , p5 , p6 , p7 , p8 );
225
248
}
226
249
227
250
@ SuppressWarnings ("unchecked" )
@@ -234,7 +257,7 @@ public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, R> Flowable<R> combineLatest(
234
257
Publisher <? extends T7 > p7 , Publisher <? extends T8 > p8 ,
235
258
Publisher <? extends T9 > p9 ,
236
259
Function9 <? super T1 , ? super T2 , ? super T3 , ? super T4 , ? super T5 , ? super T6 , ? super T7 , ? super T8 , ? super T9 , ? extends R > combiner ) {
237
- return combineLatest (Functions .toFunction (combiner ), false , bufferSize (), p1 , p2 , p3 , p4 , p5 , p6 , p7 , p8 , p9 );
260
+ return combineLatest (Functions .toFunction (combiner ), p1 , p2 , p3 , p4 , p5 , p6 , p7 , p8 , p9 );
238
261
}
239
262
240
263
@ SuppressWarnings ({ "unchecked" , "rawtypes" })
0 commit comments