fradiati
12/09/2019, 8:23 AMdiesieben07
12/09/2019, 8:24 AMmyMutableList created? And can you show the stacktrace?fradiati
12/09/2019, 8:26 AMfradiati
12/09/2019, 8:26 AMabstract class BaseRecyclerAdapter<T>(
private var masterList: MutableList<T> = mutableListOf()
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {fradiati
12/09/2019, 8:26 AMfun updateList(list: List<T>) {
masterList.clear()
masterList.addAll(list as MutableList<T>)
notifyDataSetChanged()
}diesieben07
12/09/2019, 8:27 AMMutableList<T>? addAll accepts a plain List<T>, no need for a mutable list.fradiati
12/09/2019, 8:27 AMfradiati
12/09/2019, 8:28 AMfradiati
12/09/2019, 8:28 AMdiesieben07
12/09/2019, 8:28 AMmutableListOf returns an ArrayList, which overrides addfradiati
12/09/2019, 8:29 AMfradiati
12/09/2019, 8:29 AMfun updateList(list: List<T>) {
masterList.clear()
masterList.addAll(list)
notifyDataSetChanged()
}fradiati
12/09/2019, 8:29 AMdiesieben07
12/09/2019, 8:29 AMmasterList still an ArrayList?fradiati
12/09/2019, 8:29 AMadapterBlog.updateList((List<BlogPost>) results);fradiati
12/09/2019, 8:32 AMdiesieben07
12/09/2019, 8:33 AMmasterList anywhere else? Like masterList = ... anywhere?fradiati
12/09/2019, 8:34 AMdiesieben07
12/09/2019, 8:34 AMCollections.EmptyList...