File tree Expand file tree Collapse file tree
rxjava-core/src/main/java/rx Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020import rx .Subscription ;
2121import rx .util .functions .Action0 ;
2222import rx .util .functions .FuncN ;
23+ import rx .util .functions .Function ;
2324import rx .util .functions .Functions ;
2425
2526/**
@@ -83,23 +84,6 @@ public static CompositeSubscription create(Subscription... subscriptions) {
8384 return new CompositeSubscription (subscriptions );
8485 }
8586
86- /**
87- * A {@link Subscription} implemented via an anonymous function (such as closures from other languages).
88- *
89- * @return {@link Subscription}
90- */
91- public static Subscription create (final Object unsubscribe ) {
92- final FuncN <?> f = Functions .from (unsubscribe );
93- return new Subscription () {
94-
95- @ Override
96- public void unsubscribe () {
97- f .call ();
98- }
99-
100- };
101- }
102-
10387 /**
10488 * A {@link Subscription} that does nothing when its unsubscribe method is called.
10589 */
Original file line number Diff line number Diff line change 55 * <p>
66 * Marker interface to allow instanceof checks.
77 */
8- public interface Action {
8+ public interface Action extends Function {
99
1010}
Original file line number Diff line number Diff line change 1515 */
1616package rx .util .functions ;
1717
18- import java .util .Collection ;
19- import java .util .concurrent .ConcurrentHashMap ;
20-
2118public class Functions {
2219
2320 /**
@@ -26,17 +23,11 @@ public class Functions {
2623 * @param function
2724 */
2825 @ SuppressWarnings ({ "rawtypes" })
29- public static FuncN from (final Object function ) {
26+ public static FuncN from (final Function function ) {
3027 if (function == null ) {
3128 throw new RuntimeException ("function is null. Can't send arguments to null function." );
3229 }
33-
34- /* check for typed Rx Function implementation first */
35- if (function instanceof Function ) {
36- return fromFunction ((Function ) function );
37- }
38- // no support found
39- throw new RuntimeException ("Unsupported closure type: " + function .getClass ().getSimpleName ());
30+ return fromFunction (function );
4031 }
4132
4233 @ SuppressWarnings ({ "unchecked" , "rawtypes" })
You can’t perform that action at this time.
0 commit comments