Program to print Java Set of characters in Scala
A java Set of characters can be returned from a Scala program by writing a user defined method of Java in Scala. Here, we don’t even need to import any Scala’s JavaConversions object in order to make this conversions work.
Now, lets see some examples.
[a, b, c]
Therefore, a set of characters is returned from a Java method. Here, we don’t need to import any object of Scala. In the above program a Java method is written in Scala program. Where, this method adds the character elements to the stated set one after another and then prints the results.
[j, k, l]
It is same as above example but here one more element is added in the stated set of characters and as it is a set so, the order of the elements is maintained.