We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cde7449 commit e0caeeeCopy full SHA for e0caeee
rxjava-core/src/main/java/rx/operators/OperationCast.java
@@ -20,14 +20,8 @@ public class OperationCast {
20
public static <T, R> OnSubscribeFunc<R> cast(
21
Observable<? extends T> source, final Class<R> klass) {
22
return OperationMap.map(source, new Func1<T, R>() {
23
- @SuppressWarnings("unchecked")
24
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
- }
+ return klass.cast(t);
31
}
32
});
33
0 commit comments