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>()) private val entitiesStateFlow = MutableStateFlow(emptyList<NewsResourceEntity>())
internal var topicCrossReferences: List<NewsResourceTopicCrossRef> = listOf() internal var topicCrossReferences: List<NewsResourceTopicCrossRef> = emptyList()
override fun getNewsResources( override fun getNewsResources(
useFilterTopicIds: Boolean, useFilterTopicIds: Boolean,

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

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

Loading…
Cancel
Save