How can I teach IntelliJ to not initialize Collections with null
values? (e.g. the following code will make IntelliJ mark my result
variable, saying that it needs to be initialized, and that's fine)
But when I use ALT+Enter
on it to fix this, it will always initialize with null
, although it would be better to initialize with an empty list.
public class A {
List<B> method(){
List<B> result;
try {
result = this.getResults();
} catch(Exception e){
// nothing
}
return result;
}
}
Is there a way to change this default behaviour?