The reverse method will create a new sequence with the elements in reversed order.
def reverse: Repr
val donuts: Seq[String] = Seq("Plain Donut", "Strawberry Donut", "Glazed Donut") donuts.reverse.foreach(donut => println(s"donut = $donut"))
Last updated 4 years ago