I'm trying to read in a .yaml file into my Scala code. Assume I have the following yaml file:
animals: ["dog", "cat"] I am trying to read it using the following code:
val e = yaml.load(os.read("config.yaml")).asInstanceOf[java.util.Map[String, Any]] val arr = e.getOrDefault("animals", new Java.util.ArrayList[String]()) // arr is Option[Any], but I know it contains java.util.ArrayList<String> arr.asInstanceOf[Buffer[String]] // ArrayList cannot be cast to Buffer The ArrayList is type Any, so how do I cast to a Scala Collection e.g. Buffer? (Or Seq, List...)