Skip to content

Commit 3eae708

Browse files
committed
Move cast to parent function
1 parent 7caf5e1 commit 3eae708

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

rxjava-core/src/main/java/rx/internal/operators/OperatorMerge.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public void onStart() {
9898
@Override
9999
public void onNext(Observable<? extends T> t) {
100100
if (t instanceof ScalarSynchronousObservable) {
101-
handleScalarSynchronousObservable(t);
101+
handleScalarSynchronousObservable((ScalarSynchronousObservable)t);
102102
} else {
103103
if (t == null || isUnsubscribed()) {
104104
return;
@@ -128,7 +128,7 @@ private void handleNewSource(Observable<? extends T> t) {
128128
request(1);
129129
}
130130

131-
private void handleScalarSynchronousObservable(Observable<? extends T> t) {
131+
private void handleScalarSynchronousObservable(ScalarSynchronousObservable<? extends T> t) {
132132
// fast-path for scalar, synchronous values such as Observable.from(int)
133133
/**
134134
* Without this optimization:
@@ -154,8 +154,8 @@ private void handleScalarSynchronousObservable(Observable<? extends T> t) {
154154
}
155155
}
156156

157-
private void handleScalarSynchronousObservableWithoutRequestLimits(Observable<? extends T> t) {
158-
T value = ((ScalarSynchronousObservable<T>) t).get();
157+
private void handleScalarSynchronousObservableWithoutRequestLimits(ScalarSynchronousObservable<? extends T> t) {
158+
T value = t.get();
159159
if (getEmitLock()) {
160160
try {
161161
actual.onNext(value);
@@ -177,14 +177,14 @@ private void handleScalarSynchronousObservableWithoutRequestLimits(Observable<?
177177
}
178178
}
179179

180-
private void handleScalarSynchronousObservableWithRequestLimits(Observable<? extends T> t) {
180+
private void handleScalarSynchronousObservableWithRequestLimits(ScalarSynchronousObservable<? extends T> t) {
181181
if (getEmitLock()) {
182182
boolean emitted = false;
183183
try {
184184
long r = mergeProducer.requested;
185185
if (r > 0) {
186186
emitted = true;
187-
actual.onNext(((ScalarSynchronousObservable<T>) t).get());
187+
actual.onNext(t.get());
188188
mergeProducer.REQUESTED.decrementAndGet(mergeProducer);
189189
// we handle this Observable without ever incrementing the wip or touching other machinery so just return here
190190
return;
@@ -203,7 +203,7 @@ private void handleScalarSynchronousObservableWithRequestLimits(Observable<? ext
203203
// enqueue the values for later delivery
204204
initScalarValueQueueIfNeeded();
205205
try {
206-
scalarValueQueue.onNext(((ScalarSynchronousObservable<T>) t).get());
206+
scalarValueQueue.onNext(t.get());
207207
} catch (MissingBackpressureException e) {
208208
onError(e);
209209
}

0 commit comments

Comments
 (0)