This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 17.1, “How to go to and from Java collections in Scala.”
You’re using Java classes in a Scala application, and those classes either return Java collections, or require Java collections in their method calls.
Use the methods of Scala’s
JavaConversions object to make the conversions work.