I was reading FirebaseUI library source code when I stumbled upon syntax I hadn’t seen before.

It was first folded by IntelliJ IDEA:

enter image description here

Then I had to click it to unfold:

enter image description here

What is this line?


Is it equal to this?


If it is, why was it written that way? Is it the same thing as with two ways of declaring an array in Java?

  1. Java way:
char[] letters = new char[100];
  1. C way:
char letters[] = new char[100];

(Both are acceptable.)

>Solution :

setScopes(Collections.emptyList<String>()); would be invalid, since an explicit generic type argument needs to be at the start of a method call, like shown in your other examples.

If there’s a method that wants a generic argument, but the compiler can’t make out what you want that generic argument to be, you need to specify it yourself using the syntax above. Think of it like an equivalent to new ArrayList<String>(), except for method calls: this.<String>someMethod()

Leave a Reply