File tree 3 files changed +4
-29
lines changed
rxjava-core/src/main/java/rx
3 files changed +4
-29
lines changed Original file line number Diff line number Diff line change 20
20
import rx .Subscription ;
21
21
import rx .util .functions .Action0 ;
22
22
import rx .util .functions .FuncN ;
23
+ import rx .util .functions .Function ;
23
24
import rx .util .functions .Functions ;
24
25
25
26
/**
@@ -83,23 +84,6 @@ public static CompositeSubscription create(Subscription... subscriptions) {
83
84
return new CompositeSubscription (subscriptions );
84
85
}
85
86
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
-
103
87
/**
104
88
* A {@link Subscription} that does nothing when its unsubscribe method is called.
105
89
*/
Original file line number Diff line number Diff line change 5
5
* <p>
6
6
* Marker interface to allow instanceof checks.
7
7
*/
8
- public interface Action {
8
+ public interface Action extends Function {
9
9
10
10
}
Original file line number Diff line number Diff line change 15
15
*/
16
16
package rx .util .functions ;
17
17
18
- import java .util .Collection ;
19
- import java .util .concurrent .ConcurrentHashMap ;
20
-
21
18
public class Functions {
22
19
23
20
/**
@@ -26,17 +23,11 @@ public class Functions {
26
23
* @param function
27
24
*/
28
25
@ SuppressWarnings ({ "rawtypes" })
29
- public static FuncN from (final Object function ) {
26
+ public static FuncN from (final Function function ) {
30
27
if (function == null ) {
31
28
throw new RuntimeException ("function is null. Can't send arguments to null function." );
32
29
}
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 );
40
31
}
41
32
42
33
@ SuppressWarnings ({ "unchecked" , "rawtypes" })
You can’t perform that action at this time.
0 commit comments