public static <T> Observable<T> create(
@Nonnull final Func1<Observer<? super T>, ? extends Action0> subscribe) {
return new Observable<T>() {
@Override
public Closeable register(Observer<? super T> observer) {
final Action0 a = subscribe.invoke(observer);
return new Closeable() {
@Override
public void close() {
a.invoke();
}
};
}
};
}