I know what is the difference between the generic type and the wildcard type, but in this situation I cannot use the same way again to understand.
For short, To compare both Interfaces below
public interface RequestParser {
<T extends Entity> Message<T> parseRequest(String json);
}
public interface RequestParser {
Message<? extends Entity> parseRequest(String json);
}
Only the first one can compile the below codes: (User extends Entity)
Message<User> message = requestParser.parseRequest(json);
The one uses wildcard ?
cannot succeed.
So what exactly is the difference between them in this situation ...?