rx java - Convert one type of list to another RXJava? (Javascript map equivalent) -


lets have observable observable<list<a>> , want convert observable observable<list<b>>. there best possible way convert list<a> list<b>. javascript's map's implementation ideal situation.

you can use observable.from(iterable<a>) observable<a>, map (a => b), , convert list<b> observable.tolist()

observable.from(arrays.aslist(1, 2, 3)) .map(val -> mapinttostring(val)).tolist() 

e.g.

  observable.from(arrays.aslist(1, 2, 3)) .map(val -> val + "mapped").tolist() .toblocking().subscribe(system.out::println); 

yields

[1mapped, 2mapped, 3mapped]


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -