Parsing RxJava string with type change


We take a string from the queue, parse it and check if it meets the requirements. If it matches, then we send it to the corresponding method for processing, but it is no longer a string that needs to be returned, but an array of strings that was obtained as a result of parsing .split

We take from the queue and parse .. ((filterLog) underlined in red)

Observable<String> logObservable =


 Func1<String, String[]> filterLog = new Func1<String, String[]>() {

    public String[] call(String str) {
        String[] parsedLog = str.split("\\|");
            if (mDebugType.contains(parsedLog[VALIDATION])) {
                return parsedLog;
        return null;


 Observer<String[]> observer = new Observer<String[]>() {
    public void onCompleted() {


    public void onError(Throwable e) {


    public void onNext(String[] parsedLog) {

You need to get an array, not a string


add at the end of .toList() to get it

Observable<String> logObservable = Observable.from(sQueueOfUnprocessedLogs)

then the result will be an array of strings

Scroll to Top