Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
HelloWorldStream using Rx Java 2 Android.
package async.waleed.rx;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import java.util.ArrayList;
import java.util.List;
import io.reactivex.Observable;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
List<String> list = new ArrayList<>();
list.add("H");
list.add("e");
list.add("l");
list.add("l");
list.add("o");
list.add(" ");
list.add("W");
list.add("o");
list.add("r");
list.add("l");
list.add("d");
Observable.fromIterable(list)
.filter(s -> !s.equals("l"))
.forEach(s -> Log.i("Android", s));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.