Skip to content

Commit 88c60b9

Browse files
committed
2.x: Minor generics fix to Functions
1 parent 57b8276 commit 88c60b9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/io/reactivex/internal/functions/Functions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ private Functions() {
3333
throw new IllegalStateException("No instances!");
3434
}
3535

36-
@SuppressWarnings("unchecked")
3736
public static <T1, T2, R> Function<Object[], R> toFunction(final BiFunction<? super T1, ? super T2, ? extends R> f) {
3837
ObjectHelper.requireNonNull(f, "f is null");
3938
return new Array2Func<T1, T2, R>(f);
@@ -521,12 +520,13 @@ static final class Array2Func<T1, T2, R> implements Function<Object[], R> {
521520
this.f = f;
522521
}
523522

523+
@SuppressWarnings("unchecked")
524524
@Override
525525
public R apply(Object[] a) throws Exception {
526526
if (a.length != 2) {
527527
throw new IllegalArgumentException("Array of size 2 expected but got " + a.length);
528528
}
529-
return ((BiFunction<Object, Object, R>) f).apply(a[0], a[1]);
529+
return f.apply((T1)a[0], (T2)a[1]);
530530
}
531531
}
532532

0 commit comments

Comments
 (0)