In a class without generic types I want to declare a rather complex generic field similar to these:
public class Client {
private Map<Class<T extends Serializable>, List<Consumer<S extends T>>> classToConsumerTry1;
private <T extends Serializable, S extends T> Map<Class<T>, List<Consumer<S>>> classToConsumerTry2;
}
promblem is the java compiler won't let me :)
So my question is how do I correctly introduce T and S without adding types to my class Client.
My goal is to enforce the Class
being a subtype of Serializable
and the Consumer
being a subtype of the class you chose for Class
.