Florian
07/06/2019, 5:56 PMin
is the same as contains
. What is the operator function for in
when we use it in a loop?Dominaezzz
07/06/2019, 6:09 PMiterator
.Florian
07/06/2019, 6:36 PMDico
07/06/2019, 6:40 PMoperator fun iterator()
and the return type needs to conform to
operator fun hasNext(): Boolean
operator fun next(): T
Where T can be anything, including primitives and inline classes, which won't be subject to auto boxing. That would happen if you use the Iterator
type though because of generics.Florian
07/06/2019, 6:44 PMoperator fun
Dico
07/06/2019, 6:52 PMFlorian
07/06/2019, 6:53 PMkarelpeeters
07/06/2019, 9:40 PMFlorian
07/07/2019, 8:55 AMDominaezzz
07/07/2019, 12:46 PMexpect
?Florian
07/07/2019, 1:19 PMkarelpeeters
07/07/2019, 3:07 PMFlorian
07/07/2019, 3:45 PMpublic operator fun iterator(): Iterator<T>
Dico
07/07/2019, 4:08 PMFlorian
07/07/2019, 4:09 PMDico
07/07/2019, 4:12 PM