https://kotlinlang.org logo
#announcements
Title
# announcements
u

uhe

04/09/2016, 1:18 PM
totally untested and with iterator:
Copy code
commands.listIterator().run {
       forEach {
           when (it) {
               is Clear -> plot.clear()
               is AddPoints -> plot.addPoints(it.x, it.y)
               is AddPoint -> plot.addPoint(it.x, it.y)
           }
           remove()
       }
   }