I am trying to collect some property from list of objects into array using RxJava. I've wrote the code, but now I can't cast return type properly. So, I've tried this code:
Observable.just(rangeList)
.flatMap(Observable::from)
.map((range) -> String.format(Locale.getDefault(), "%s (%d)", range, range.getElementNumber()))
.cast(String.class)
.toList()
.toBlocking().first()
.toArray();
But it still returns Object[], and I need String[].