You can enter an empty list like this, however this is probably not necessary if you are not trying to set up an example spring XML config template, perhaps.
<property name="cars"> <list></list> </property>
If you want to quickly set empty lists to prevent null pointer issues, just use Collections.emptyList (). You can also do this inline as follows. Note that Collections.emptyList () returns an unmodifiable list.
public class StackOverflow { private List<Car> cars = Collections.emptyList();
You will also need getters and setters for cars that can use it from spring XML.
source share