If you donβt really care about what type of thing this will have, you can parameterize it with [_, _]. Examples are things like
val thing = new SomeClass[_, _]()
or
def thingDoer(sc: SomeClass[_, _]) { /* Stuff */ }
To be more understandable in nature, an underscore is called an "existential type", and it is basically equivalent to a raw type in Java, and it can also function like a Java lookup pattern. For example, this schizophrenic Java code
public void thingThatTakesAMapList(List<? extends Map> mapList) { }
matches this scala code
def thingThatTakesAMapList(mapList: List[_ <: Map[_, _]]) { /* Some incredibly wild subroutine */ }
In addition, it is worth noting that the differences between List [Any] and List [_] ... are very subtle. This means that the first is a list of People, and the last is a list of [I don't know / care]. _ other than Any. For example, if you had a class with this signature
class SillyClass[T <: Map[_, _]]
it would be wrong to do it
val thing = new SillyClass[Any]()
while it may be valid for you to do so
val thing = new SillyClass[HashMap[_, _]]()
and if the function took SillyClass as a parameter, you could write
def sillyClassTaker(sc: SillyClass[_])
and make sure sc will not be parameterized over type Any; it is parameterized over some unknown subclass of Map [_, _]. In other words, the underscore is a placeholder , but still requires the correct type parameters in place. So, while everything is cool and everything ... I do not recommend using it too much. If you need to do something ... wildcard-y or just don't care about type parameters, this is a good option to consider.