假设您必须返回一个集合,并且您不想每次都创建几个对象。
interface Configurable { List<String> getConfigurationList();}// class which doesn't have any configurationclass SimpleConfigurable implements Configurable { public List<String> getConfigurationList() { return Collections.emptyList(); }}返回空集合通常比返回更可取
null



