Observable.compose Generics

Manual merge of https://github.com/ReactiveX/RxJava/pull/1762 with an extra unit test added.