Usage of Collections.EMPTY_LIST

Hi Adam,

Sorry, I think could have added more details about my dependencies type.

Your example works because you did not specify the List type but thinking a little bit more now, I could have specified the type when using Collections.emptyList(), likewise “this.dependencies == Collections.emptyList()”.

private List dependencies = Collections.emptyList();

if(this.dependencies == Collections.emptyList()){ //Now it works.
this.dependencies = new ArrayList<>();
}

Would be helpful to see such example as part of the “Compliant Solution”. What do you think?