When you don't need a map

1 · Daniel Lew · Feb. 20, 2018, 1:27 p.m.
Here's a sketch of how one could listen to connectivity changes on Android via an Observable of NetworkInfo: val networkInfo: Observable<NetworkInfo> = ... networkInfo .map { it.isConnected } .subscribe { onConnectivityChange(it) } While it works as expected, I would argue that the map() is unnecessary. You could do the transformation in...