A nearly unknown feature of Java is this generics syntax:
public class Baz<T extends Foo & Bar> {}
I would like to do the same in Scala but I don’t know how to do it, can someone give me the syntax please?
I had previously:
class MongoObject[T <: CaseClass]
And now i need:
class MongoObject[T <: IdentifiableModel & CaseClass]
Or at least something similar
Thanks
You can use the
withkeyword just as you would in an extends clause:This means that
Thas to be a subtype ofIdentifiableModelandCaseClass.