Skip to content

Instantly share code, notes, and snippets.

@felixchez
Created November 1, 2018 19:15
Show Gist options
  • Save felixchez/553c43135f6701d71cc9cce5c820848f to your computer and use it in GitHub Desktop.
Save felixchez/553c43135f6701d71cc9cce5c820848f to your computer and use it in GitHub Desktop.
val dataTypeA = arrayListOf(1, 2, 3)
Observable.fromIterable(dataTypeA)
.map {element -> when (element) {
1 -> "one"
2 -> "two"
3 -> "three"
else -> ""
}}
.toList().toObservable()
// The result will be
// dataTypeB = arrayListOf<String>("one", "two", "three")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment