인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

Inflearn Community Q&A

min's profile image
min

asked

Easy-to-understand introduction to Modern Android Development by Frozen Coder

Practice2D - Displaying search results in UI (Coil, ListAdapter, SaveStateHandle)

[BookSearchAdapter] onBindViewHolder의 currentList[position] 질문

Written on

·

267

0

안녕하세요 선생님! 강의 잘 듣고 있습니다.

한 가지 궁금한게 있어서 질문 남깁니다.

다름아니라, BookSearchAdapter의 onBindViewHolder에서 book의 position을 currentList에서 가져오시던데,
val book = currentList[position]과
val book = getItem[position]의 차이점이 무엇인지 궁금합니다...!

기능적으로 차이가 없다면, 경우에 따라 어떤 것을 사용하는것이 더 효율적인지 궁금합니다! 감사합니다.

androidkotlin아키텍처jetpack

Answer 1

1

frozencoder님의 프로필 이미지
frozencoder
Instructor

getCurrentList는 현재 표시되고 있는 데이터의 변경 불가능한 복사본을 반환하고, getItem은 특정 위치의 개별 데이터 항목을 얻는데 사용합니다. 데이터를 조작할 목적이 아닌 UI 표시에 필요한 데이터는 getCurrentList로 획득하는 것이 적절합니다.

min's profile image
min

asked

Ask a question