Scala Stack :+() method with example
In Scala, scala.collection.mutable implements Stack data structure. The :+ method is used to create a copy of this stack with an element appended.
Method Definition – def :+(elem: A)
Returns – a new stack consisting of all elements of this stack followed by elem.
List(11, 12, 13, 14, 15, 100)
Stack(Geeks, For, Stack(1, 2, 3))