Here is the code I'm looking at (using Google's ImmutableMap)
ImmutableMap.<String,String>of();
What does this mean? What is the significance of doing
Class.<GenericType>methodName()?
ImmutableMap is a generic class with two type parameters, K and V. This syntax gives the concrete values for the two parameters, both being String in this case.
So the above returns an empty map of String to String.
See JLS 15.2 which among other things says a method invokation is
MethodInvocation:
TypeName . NonWildTypeArguments Identifier ( ArgumentListopt )
Here the Type Arguments are String and String
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With