Skip to content

Commit 4f5653c

Browse files
authored
Merge pull request #1894 from hoangchungk53qx1/main
Refactor: Replace list initialization with emptyList() for clarity
2 parents 5c28320 + 3c50260 commit 4f5653c

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

core/data/src/test/kotlin/com/google/samples/apps/nowinandroid/core/data/testdoubles/TestNewsResourceDao.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class TestNewsResourceDao : NewsResourceDao {
3636

3737
private val entitiesStateFlow = MutableStateFlow(emptyList<NewsResourceEntity>())
3838

39-
internal var topicCrossReferences: List<NewsResourceTopicCrossRef> = listOf()
39+
internal var topicCrossReferences: List<NewsResourceTopicCrossRef> = emptyList()
4040

4141
override fun getNewsResources(
4242
useFilterTopicIds: Boolean,

core/database/src/main/kotlin/com/google/samples/apps/nowinandroid/core/database/model/NewsResourceEntity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,5 @@ fun NewsResourceEntity.asExternalModel() = NewsResource(
4949
headerImageUrl = headerImageUrl,
5050
publishDate = publishDate,
5151
type = type,
52-
topics = listOf(),
52+
topics = emptyList(),
5353
)

core/network/src/main/kotlin/com/google/samples/apps/nowinandroid/core/network/model/NetworkNewsResource.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@
1616

1717
package com.google.samples.apps.nowinandroid.core.network.model
1818

19+
import android.annotation.SuppressLint
1920
import com.google.samples.apps.nowinandroid.core.model.data.NewsResource
2021
import kotlinx.datetime.Instant
2122
import kotlinx.serialization.Serializable
2223

2324
/**
2425
* Network representation of [NewsResource] when fetched from /newsresources
2526
*/
27+
@SuppressLint("UnsafeOptInUsageError")
2628
@Serializable
2729
data class NetworkNewsResource(
2830
val id: String,
@@ -32,5 +34,5 @@ data class NetworkNewsResource(
3234
val headerImageUrl: String,
3335
val publishDate: Instant,
3436
val type: String,
35-
val topics: List<String> = listOf(),
37+
val topics: List<String> = emptyList(),
3638
)

0 commit comments

Comments
 (0)