【发布时间】:2012-03-25 21:59:41
【问题描述】:
public class Demo {
private final List<E> blah;
public demo(final List<E> result) {
super();
this.blah = Collections.unmodifiableList(result);
}
public List<E> getResult() {
return blah;
}
public static void main(final String args[]) {
final Demo d = new Demo(Collections.EMPTY_LIST);
System.out.println(d.getResult().get(0));
}
}
发生了什么以及为什么。什么是转机。?如果我尝试做第 1 行,通用性会丢失吗?
【问题讨论】:
标签: java collections