java - Unchecked assignment when initializing a list -


this question has answer here:

what difference between

list<string> list = new arraylist(); 

and

list<string> list = new arraylist<>(); 

?

in first case, ide highlights , says "unchecked assignment", seem behave same.

no difference, java compiler figure out type, better add inferred type argument:

list<string> list = new arraylist<string>(); 

Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -