List.subList()

Eungi Kim·2020년 11월 5일
0

OutOfMemory 에러가 나와 살펴보니 필요없어진 리스트를 자를 때 subList 를 했는데 해당 함수에서 리턴되는 리스트는 View 로서 원본, 반환된 리스트를 수정해도 다른 리스트에 영향을 끼친다고 한다.

특정 범위를 제거하는 관용구.

list.subList(from, to).clear();

"https://developer.android.com/reference/java/util/ArrayList#subList(int,%20int)"

profile
Run and gun and debugun

0개의 댓글