Conversion from Java List to Scala Buffer Last Updated : 21 Nov, 2019 Comments Improve Suggest changes Like Article Like Report A Java list can be converted to a Scala Buffer by importing JavaConversions.asScalaBuffer method. Here, we need to call asScalaBuffer method which has a java list as its argument. Therefore, this method returns a Scala Buffer. Now, lets see some examples. Example:1# Scala // Scala program of converting a Java list // to a Scala Buffer // Importing JavaConversions.asScalaBuffer import scala.collection.JavaConversions.asScalaBuffer // Creating object object GfG { // Main method def main(args:Array[String]) { // Creating Java List val jlist = java.util.Arrays.asList(11, 12, 13) // Converting from java list // to Scala Buffer val results= asScalaBuffer(jlist) // Displays results println(results) } } Output: Buffer(11, 12, 13) Therefore, a Scala Buffer is returned. Example:2# Scala // Scala program of converting a Java list // to a Scala Buffer // Importing JavaConversions.asScalaBuffer import scala.collection.JavaConversions.asScalaBuffer // Creating object object GfG { // Main method def main(args:Array[String]) { // Creating Java List val jlist = java.util.Arrays.asList(6, 2, 8, 1) // Converting from java list // to Scala Buffer val results= asScalaBuffer(jlist) // Displays results println(results) } } Output: Buffer(6, 2, 8, 1) Comment More infoAdvertise with us Next Article Conversion from Java List to Scala Buffer N nidhi1352singh Follow Improve Article Tags : Scala Java-Collections Scala scala-collection Practice Tags : Java-Collections Similar Reads Conversion from a Java Set to a Scala Set A Java Set can be converted to a Scala Set by importing JavaConversions.asScalaSet method. Here, we need to call asScalaSet method which has a java Set as its argument. Therefore, this method returns a Scala Set. Now, lets see some examples. Example:1# Scala // Scala program of converting a Java Set 2 min read Program to convert Java list to an iterator in Scala A java list can be converted to an iterator in Scala by utilizing toIterator method of Java in Scala. Here, we need to import Scalaâs JavaConversions object in order to make this conversions work else an error will occur. Now, lets see some examples and then discuss how it works in details. Example: 3 min read Program to convert Java list of bytes to Seq in Scala A java list of bytes can be converted to sequence in Scala by utilizing toSeq method of Java in Scala. Here, we need to import Scalaâs JavaConversions object in order to make this conversions work else an error will occur. Now, lets see some examples and then discuss how it works in details. Example 1 min read Program to convert Java list to Seq in Scala A java list can be converted to sequence in Scala by utilizing toSeq method of Java in Scala. Here, you need to import Scalaâs JavaConversions object in order to make this conversions work else an error will occur. Now, lets see some examples and then discuss how it works in details. Example:1# Scal 2 min read Program to convert Java Set to List in Scala A java Set can be converted to a List in Scala by utilizing toList method of Java in Scala. Here, we need to import Scalaâs JavaConversions object in order to make this conversions work. Now, lets see some examples and then discuss how it works in details. Example:1# Scala // Scala program to conver 2 min read Like