Scala Map toSeq() method with example Last Updated : 29 Jul, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report The toSeq() method is utilized to display a sequence from the Scala map. Method Definition: def toSeq: Seq[A] Return Type: It returns a sequence from the stated map. Example #1: Scala // Scala program of toSeq() // method // Creating object object GfG { // Main method def main(args:Array[String]) { // Creating a map val m1 = Map(3 -> "geeks", 4 -> "for", 4 -> "for") // Applying toSeq method val result = m1.toSeq // Displays output println(result) } } Output: ArrayBuffer((3, geeks), (4, for)) Example #2: Scala // Scala program of toSeq() // method // Creating object object GfG { // Main method def main(args:Array[String]) { // Creating a map val m1 = Map(3 -> "geeks", 4 -> "for", 2 -> "cs") // Applying toSeq method val result = m1.toSeq // Displays output println(result) } } Output: ArrayBuffer((3, geeks), (4, for), (2, cs)) Comment More infoAdvertise with us Next Article Scala Set toSeq() method with example N nidhi1352singh Follow Improve Article Tags : Scala Scala Scala-Method Scala-Map Similar Reads Scala Map toSet() method with example The toSet() method is utilized to display a set from the Scala map. Method Definition: def toSet: Set[A] Return Type: It returns a set from the stated map. Example #1: Scala // Scala program of toSet() // method // Creating object object GfG { // Main method def main(args:Array[String]) { // Creatin 1 min read Scala Map toList() method with example The toList() method is utilized to display the elements of the map in the list. Method Definition: def toList: List[A] Return Type: It returns all the elements of the map in the list. Example #1: Scala // Scala program of toList() // method // Creating object object GfG { // Main method def main(arg 1 min read Scala Map take() method with example The take() method is utilized to select the first 'n' elements of the map. Method Definition: def take(n: Int): Map[A, B] Return Type: It returns the first 'n' elements of the map. Example #1: Scala // Scala program of take() // method // Creating object object GfG { // Main method def main(args:Arr 1 min read Scala Map toString() method with example The toString() method is utilized to display a string from the Scala map. Method Definition: def toString(): String Return Type: It returns a string from the stated map. Example #1: Scala // Scala program of toString() // method // Creating object object GfG { // Main method def main(args:Array[Stri 1 min read Scala Set toSeq() method with example The toSeq() method is utilized to return a seq consisting of all the elements of the set. Method Definition: def toSeq: Seq[A] Return Type: It returns a seq consisting of all the elements of the set. Example #1: Scala // Scala program of toSeq() // method // Creating object object GfG { // Main meth 1 min read Scala Map toArray() method with example The toArray() method is utilized to display an array from the Scala map. Method Definition: def toArray: Array[(A, B)] Return Type: It returns an array from the stated map. Example #1: Scala // Scala program of toArray() // method // Creating object object GfG { // Main method def main(args:Array[St 1 min read Like