Partially migrate to new collections

This commit is contained in:
Koitharu
2024-01-31 15:55:33 +02:00
parent a4e2675d61
commit edca0e5334
8 changed files with 31 additions and 12 deletions

View File

@@ -1,6 +1,7 @@
package org.koitharu.kotatsu.tracker.domain
import androidx.annotation.VisibleForTesting
import androidx.collection.MutableLongSet
import coil.request.CachePolicy
import org.koitharu.kotatsu.core.model.getPreferredBranch
import org.koitharu.kotatsu.core.parser.MangaRepository
@@ -30,7 +31,7 @@ class Tracker @Inject constructor(
if (sources.isEmpty()) {
return emptyList()
}
val knownManga = HashSet<Long>()
val knownManga = MutableLongSet()
val result = ArrayList<TrackingItem>()
// Favourites
if (AppSettings.TRACK_FAVOURITES in sources) {

View File

@@ -1,6 +1,7 @@
package org.koitharu.kotatsu.tracker.domain
import androidx.annotation.VisibleForTesting
import androidx.collection.MutableLongSet
import androidx.room.withTransaction
import dagger.Reusable
import kotlinx.coroutines.flow.Flow
@@ -74,7 +75,7 @@ class TrackingRepository @Inject constructor(
ids.windowed(MAX_QUERY_IDS, MAX_QUERY_IDS, true)
.flatMap { dao.findAll(it) }
}.groupBy { it.mangaId }
val idSet = HashSet<Long>()
val idSet = MutableLongSet(mangaList.size)
val result = ArrayList<MangaTracking>(mangaList.size)
for (item in mangaList) {
val manga = if (item.isLocal) {