bj0
12/19/2017, 10:05 PMIterable
without creating an array or list?adam-mcneilly
12/19/2017, 10:05 PMTravis
12/19/2017, 10:05 PMlistOf(element)
would be iterable, but it builds a list…adam-mcneilly
12/19/2017, 10:07 PMbj0
12/19/2017, 10:07 PMwhen
condition inside a flatMap
, most of the conditions return lists but one has a single element, I was wondering if there was something without the (probably very low) overhead of creating an unnecessary list/array.just()
from Rxadam-mcneilly
12/19/2017, 10:09 PMTravis
12/19/2017, 10:10 PMlistOf(element)
- I mean, Observable.just
still creates an Observable…bj0
12/19/2017, 10:10 PMflatMap
expects an Iterable
Travis
12/19/2017, 10:10 PMadam-mcneilly
12/19/2017, 10:11 PMbj0
12/19/2017, 10:11 PMIterable
, but I don't see anything like thatflatMap
, and flatMap
requires an Iterable<T>
paulblessing
12/19/2017, 10:12 PMlistOf()
with a single item ultimately creates a java.util.SingletonList
(on the JVM at least) which is a very lightweight list implementation.bj0
12/19/2017, 10:13 PM