We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
open val loadTaskObserver : ((List<T>, Refreshable?) -> Observer<List<T>>)? = { originData: List<T>, refreshable: Refreshable? -> object: Observer<List<T>>{ override fun onNext(netData: List<T>) { val lastItem = if(!originData.isEmpty()) originData[originData.size-1] else null val isLoadMore = lastItem != null val newData = ArrayList<T>() if (isLoadMore) { newData.addAll(originData) } newData.addAll(netData) data.clear() data.addAll(newData) } override fun onComplete() { refreshable?.endRefresh() } override fun onError(e: Throwable) {} override fun onSubscribe(d: Disposable) {} } }
TwoWayListVM里面加载数据是每次都把原数据复制一次,随着数据的加载,originData肯定是越来越大的,每次都把它复制一遍不会很费时间和内存吗?尤其是它变得越来越大的时候,虽然整个过程是用RxJava做了异步的
TwoWayListVM
originData
RxJava
The text was updated successfully, but these errors were encountered:
@Zeleven 其实还好,addAll() 是浅拷贝不是深拷贝(clone)
Sorry, something went wrong.
No branches or pull requests
TwoWayListVM
里面加载数据是每次都把原数据复制一次,随着数据的加载,originData
肯定是越来越大的,每次都把它复制一遍不会很费时间和内存吗?尤其是它变得越来越大的时候,虽然整个过程是用RxJava
做了异步的The text was updated successfully, but these errors were encountered: