https://kotlinlang.org logo
Title
h

Hullaballoonatic

09/11/2018, 9:54 PM
how do I instantiate an iterator in kotlin? every iterator is an interface
a

Andreas Sinz

09/11/2018, 9:55 PM
That sounds like an XY Problem. What are you trying to achieve?
h

Hullaballoonatic

09/11/2018, 9:56 PM
draw a line between every point in a list of points
n

Nikky

09/11/2018, 9:57 PM
that sounds like you always want to process one point with the next
h

Hullaballoonatic

09/11/2018, 9:57 PM
so from it to it.next() presumbaly. i could do like...
for (point in 0 until points.size -1)
?
and just use
points[point]
and
points[point+1]
but i figured kotlin has a more elegant solution
n

Nikky

09/11/2018, 10:00 PM
^ that.. i knew there was a thing for this, in other cases maybe fold would have been useful too
a

Andreas Sinz

09/11/2018, 10:00 PM
h

Hullaballoonatic

09/11/2018, 10:00 PM
looks like it was deleted? because
CharSequence
?
ah
beautiful, thank you
a

Andreas Sinz

09/11/2018, 10:01 PM
yep, at first i posted the wrong one of
CharSequence