A java list of characters can be converted to a String in Scala by utilizing toString method of Java in Scala. Here, you 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.
[l, m, n]
Here, the duplicate elements are eliminated and the resultant order of the elements in list is same as stated above.
[d, b, c]
Here, the stated list is not in correct order so, the resultant output is also not in proper order.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.