In Scala, how do I declare a Java List that can hold anything?
List[Object] gets upset if I try and put a tuple in it, Scala errors says
type mismatch; found : java.util.List[Triple[Integer,Integer, Integer]] required:
java.util.List[Object] Note: Triple[Integer,Integer, Integer] <: Object, but Java-defined
trait List is invariant in type E. You may wish to investigate a wildcard type
such as `_ <: Object`. (SLS 3.2.10)
I don't know what this means, how do I declare the list to hold a triple (or a tuple, or anything)
My code looks like this (it is twirl, so it has @, but it is just Scala code):
@import java.util.List;
@(field:List[Object], min:Int=1)(f: Object, Int) => Html)
@{
(0 until math.max(if (field.isEmpty) 0 else field.size, min))
.map(i => f(field.get(i),i))
}