on-internet
← Community

How to fix concurrent modification exception in Kotlin

Stack Overflow ·

This is my code, in which I am adding data to a list: fun bindProcess(listOfDocId: MutableList<String>, isActvityLogEnabled: Boolean): Observable<MutableList<SearchResultModel>> { return Observable.create<MutableList<SearchResultModel>> { var filteredList =CopyOnWriteArrayList<SearchResultModel>()// mutableListOf<SearchResultModel>() val headerItem: SearchResultModel = SearchResultModel() headerItem.type = 0 headerItem.title = context.getString(R.string.top_matches_label) filteredList.add(headerItem) for (row in ContSyncApplication.getContacts()) { if (listOfDocId.contains(row.docId)) { val my

Comments

Sign in or sign up to comment and upvote.

No comments yet.