Refactor: Replace list initialization with emptyList() for clarity

pull/1894/head
hoangchungk53qx1 2 months ago
parent ba1a463498
commit 3c5026065d

@ -36,7 +36,7 @@ class TestNewsResourceDao : NewsResourceDao {
private val entitiesStateFlow = MutableStateFlow(emptyList<NewsResourceEntity>())
internal var topicCrossReferences: List<NewsResourceTopicCrossRef> = listOf()
internal var topicCrossReferences: List<NewsResourceTopicCrossRef> = emptyList()
override fun getNewsResources(
useFilterTopicIds: Boolean,

@ -49,5 +49,5 @@ fun NewsResourceEntity.asExternalModel() = NewsResource(
headerImageUrl = headerImageUrl,
publishDate = publishDate,
type = type,
topics = listOf(),
topics = emptyList(),
)

@ -16,6 +16,7 @@
package com.google.samples.apps.nowinandroid.core.network.model
import android.annotation.SuppressLint
import com.google.samples.apps.nowinandroid.core.model.data.NewsResource
import kotlinx.datetime.Instant
import kotlinx.serialization.Serializable
@ -23,6 +24,7 @@ import kotlinx.serialization.Serializable
/**
* Network representation of [NewsResource] when fetched from /newsresources
*/
@SuppressLint("UnsafeOptInUsageError")
@Serializable
data class NetworkNewsResource(
val id: String,
@ -32,5 +34,5 @@ data class NetworkNewsResource(
val headerImageUrl: String,
val publishDate: Instant,
val type: String,
val topics: List<String> = listOf(),
val topics: List<String> = emptyList(),
)

Loading…
Cancel
Save