reverse

definition

The reverse method will create a new sequence with the elements in reversed order.

def reverse: Repr

demo

val donuts: Seq[String] = Seq("Plain Donut", "Strawberry Donut", "Glazed Donut")

donuts.reverse.foreach(donut => println(s"donut = $donut"))

Last updated