There's this question for Java How to declare a map with variable generics?
I have the exact same problem. Is there a better/Scala way of solving it?
EDIT: I tried following the above answer, but without implementing an internal map.
private class SectionConversionMap
extends HashMap[SectionSchema[_], (Iterable[HtmlRow]) => Option[Iterable[_]]]
{
override def +[T, B1 >: ( Iterable[HtmlRow] ) =>
Option[Iterable[T]]](kv: (SectionSchema[T], B1)):
HashMap[SectionSchema[_], B1] = {
val m = super.+(kv)
m
}
}
But my IDE keeps insisting that
Expression of type HashMap[SectionSchema[_], Any] doesn't conform to expected type HashMap[SectionSchema[_], B1]