Skip to content

Commit e0caeee

Browse files
committed
Used 'cast' to remove SuppressWarnings
1 parent cde7449 commit e0caeee

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

rxjava-core/src/main/java/rx/operators/OperationCast.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,8 @@ public class OperationCast {
2020
public static <T, R> OnSubscribeFunc<R> cast(
2121
Observable<? extends T> source, final Class<R> klass) {
2222
return OperationMap.map(source, new Func1<T, R>() {
23-
@SuppressWarnings("unchecked")
2423
public R call(T t) {
25-
if (klass.isAssignableFrom(t.getClass())) {
26-
return (R) t;
27-
} else {
28-
throw new ClassCastException(t.getClass()
29-
+ " cannot be cast to " + klass);
30-
}
24+
return klass.cast(t);
3125
}
3226
});
3327
}

0 commit comments

Comments
 (0)