[Java] Read only List (UnModifiableList)
읽기전용으로 List를 생성함. List에 modify 가 일어나면 UnsupportedOperationException 이 발생 List list = new anyList(); // any list (ArrayList, LinkedList other..) list.add(any); List readOnlyList = java.util.Collections.unmodifiableList(list); readOnlyList.get(index); // OK readOnlyList.set(index, any); // throw UnsupportedOperationException readOnlyList.add(any); // throw UnsupportedOperationException readOnlyLis..
Development
2018. 2. 18. 15:07
최근에 올라온 글
글 보관함
- Total
- Today
- Yesterday