I'm trying to understand below Java method from the Spring API project.
This method is used to get response a HTTP GET at another server.
As per my understanding of abstract datatype, I think that we provide the response datatype as ResponseEntity<T>
is enough to interpret the returned value of a method.
Why do we need <T>
before the return type of this method?
public <T> ResponseEntity<T> getWithJson(String url, @Nullable String json, Class<T> type) {