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);.....1
System.out.println(d.getResult().get(0));
}
}
어떻게됩니까
이유에서 첫 번째 요소를 가져보십시오. turaround는 무엇입니까? 내가 1 행을하려고하면 일반성이 사라지나요?빈 콜렉션
일처럼 만들어야합니다 (일부
get(i)
로 접근 한 후 등) 요소를 추가 할 수 있도록하려면 그냥 체크 EMPTY_LIST는, 불변 심하게 형성된 질문을 설명하십시오. – epoch