The java generics tutorial contains the following explanation about the diamond operator that answers your question:
In Java SE 7 and later, you can replace the type arguments required to invoke the constructor of a generic class with an empty set of type arguments (<>) as long as the compiler can determine, or infer, the type arguments from the context.
The compiler can determine the String
type argument to invoke the constructor because you specified it in the left part of your assignment ArrayAdapter<String> arrayAdapter = ...
, so there is no need to specify it.