dave08
10/03/2017, 12:18 PMoperator iterator() that returns a custom iterator that implements operator hasNext() and operator next(), to return a List? It seems that currently the only way is to make a mutable list and then for (e in iterator) list.add(e)...?fourlastor
10/03/2017, 12:34 PMList constructorfourlastor
10/03/2017, 12:34 PMval list = List(count, { index -> valueFor(index) })fourlastor
10/03/2017, 12:35 PMfourlastor
10/03/2017, 12:36 PMdave08
10/03/2017, 12:39 PMin to work...dave08
10/03/2017, 12:41 PMfourlastor
10/03/2017, 12:42 PMIterable, let me look up the functionfourlastor
10/03/2017, 12:42 PMtoList()fourlastor
10/03/2017, 12:42 PMdave08
10/03/2017, 12:46 PMpublic inline fun <T> Iterable(crossinline iterator: () -> Iterator<T>): Iterable<T> = object : Iterable<T> {
override fun iterator(): Iterator<T> = iterator()
}
Doesn't help in this case... since my iterator() function doesn't return a real Iterable, oh well I guess back to the harder way... 😢