I couldn't understand the following statement while it is indeed compilable:
List<Integer> l = Collections.<Integer>singletonList(5);
Say, the second <Integer>
, how can we put a single <Integer>
in front of the method name? I suspect it's a declaration of generics but cannot find it anywhere. But I only know the definition such as List<Integer>
, put <Integer>
behind a generics type. Can anybody point out me a tutorial for this grammar or find the duplicated question (sorry I didn't find one during my quick search)?
Many thanks!