There is no special function to pass parameters, just use final
.
public Observable<String[]> splitWords(final String phrase) { return Observable.fromCallable(new Callable<String[]>() { @Override public String[] call() throws Exception { return phrase.split("\\s+"); } });}
public Observable<String[]> splitWords(final String phrase) { return Observable.create(new ObservableOnSubscribe<String[]>() { @Override public void subscribe(@NonNull ObservableEmitter<String[]> emitter) throws Exception { emitter.onNext(phrase.split("\\s+")); emitter.onComplete(); } });}