search filters ConcurrentModificationException

When you selecting a lot of filters (so it's filters a lot) your getting a ConcurrentModificationException probably becauz the filter method (SearchResultsActivity.filter(applist)) is being called multiple times and using the same list to filter from so the solution is to initialize a new list at the start of the SearchResultsActivity.filter() method and use it to do the filtering

so the code in SearchResultsActivity.filter() should look like this:

val tempList = mutableListOf<App>()
tempList.addAll(appList)

filter = FilterProvider.with(this).getSavedFilter()
return tempList
            .asSequence()
            .filter { if (!filter.paidApps) it.isFree else true }
            .filter { if (!filter.appsWithAds) !it.containsAds else true }
            .filter { if (!filter.gsfDependentApps) it.dependencies.dependentPackages.isEmpty() else true }
            .filter { if (filter.rating > 0) it.rating.average >= filter.rating else true }
            .filter { if (filter.downloads > 0) it.installs >= filter.downloads else true }
            .toList()
Edited by J E