Scala Queue ++=() method with example Last Updated : 18 Oct, 2019 Comments Improve Suggest changes Like Article Like Report The ++=() method is utilized to add element of a queue at the back of another queue. Method Definition: def ++=(xs: IterableOnce[A]): Queue.this.type Return Type: It returns the given queue with elements of another queue added at its end. Example #1: Scala // Scala program of ++=() // method // Import Queue import scala.collection.mutable._ // Creating object object GfG { // Main method def main(args:Array[String]) { // Creating a queue val q1 = Queue(3, 4, 5) val q2 = Queue(1, 2) // Applying ++=() method q2.++=(q1) // Display output print(q2) } } Output: Queue(1, 2, 3, 4, 5) Example #2: Scala // Scala program of ++=() // method // Import Queue import scala.collection.mutable._ // Creating object object GfG { // Main method def main(args:Array[String]) { // Creating a queue val q1 = Queue("for", "geeks") val q2 = Queue("geeks") // Applying ++=() method q2.++=(q1) // Display output print(q2) } } Output: Queue(geeks, for, geeks) Comment More infoAdvertise with us Next Article Scala Queue ++=() method with example R rupesh_rao Follow Improve Article Tags : Scala Scala Scala-Method scala-collection Similar Reads Scala Queue +=() method with example The +=() method is utilized to add an element at the back of a given queue. Method Definition: def +=(elem: A): Queue.this.type Return Type: It returns the given queue with an element added at its back. Example #1: Scala // Scala program of +=() // method // Import Queue import scala.collection.muta 1 min read Scala Queue +=:() method with example The +=:() method is utilized to add an element at the front of a queue. Method Definition: def +=:(elem: A): Queue.this.type Return Type: It returns the given queue with an element added at its front. Example #1: Scala // Scala program of +=:() // method // Import Queue import scala.collection.mutab 1 min read Scala Queue ++() method with example The ++() method is utilized to return a new queue with all the elements of the queue appended at the back of another queue. Method Definition: def ++[B >: A](suffix: IterableOnce[B]): Queue[B] Return Type: It return a new queue with all the elements of the queue appended at the back of another qu 1 min read Scala Queue :+() method with example The :+() method is utilized to return a new queue with an element added at the back of the given queue. Method Definition: def:+[B >: A](elem: B): Queue[B] Return Type: It returns a new queue with an element added at the back of the given queue. Example #1: Scala // Scala program of :+() // metho 1 min read Scala Queue ++:() method with example The ++:() method is utilized to return a new queue with all the elements of the queue appended at the front of another queue. Method Definition: def ++:[B >: A](prefix: IterableOnce[B]): Queue[B] Return Type: It returns a new queue with all the elements of the queue appended at the front of anoth 1 min read Like