Created
March 12, 2017 12:09
-
-
Save Hafiz-Waleed-Hussain/a3acd794e4942f296531018bdcad2a23 to your computer and use it in GitHub Desktop.
ArrayOfInteger using Rx Java 2 Android.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package async.waleed.rx; | |
import android.os.Bundle; | |
import android.support.v7.app.AppCompatActivity; | |
import android.util.Log; | |
import io.reactivex.Observable; | |
public class MainActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
Integer[] data = {1, 2, 3, 4}; | |
Observable.fromArray(data) | |
.map(value -> value * value) | |
.map(value -> Integer.toString(value)) | |
.forEach(string -> Log.i("Android", string)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment