Reputation: 37798
Sometimes this (relatively strange looking) syntax is required to avoid a type mismatch. But what's the name of that syntax actually?
Usage example from Google Guava (r07):
ImmutableMap defines a method
public static <K, V> Builder<K, V> builder()
It can be used like this:
ImmutableMap<String, String> map =
ImmutableMap.<String, String>builder().put("a", "A").build();
Which is by the way the inlined version of:
Builder<String, String> builder = ImmutableMap.builder();
ImmutableMap<String, String> map = builder.put("a", "A").build();
Upvotes: 4
Views: 132
Reputation: 1858
if the syntax you are talking about is angular brackets, then they are called TYPE PARAMETERS.
Upvotes: 3
Reputation: 421310
I don't think that syntax has a particular name. I've reviewed the JLS and it just mentions it as "a call to a generic method".
In your case one could narrow it down to "a call to a non-static generic method".
If you're referring to the fact that the type parameters are present on the call-side, you simply say "a call to a generic method with explicit type parameters".
To give an example where it is (sort of) mentioned in the JLS
Deciding whether a method is applicable will, in the case of generic methods (§8.4.4), require that actual type arguments be determined. Actual type arguments may be passed explicitly or implicitly. If they are passed implicitly, they must be inferred (§15.12.2.7) from the types of the argument expressions.
Upvotes: 6