Skip to content

Commit 2650955

Browse files
authored
rtdb: replace HashMap() with hashMapOf() (#349)
1 parent b3263b3 commit 2650955

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

database/app/src/main/java/com/google/firebase/referencecode/database/kotlin/ReadAndWriteSnippets.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,12 @@ abstract class ReadAndWriteSnippets {
133133

134134
// [START post_stars_increment]
135135
private fun onStarClicked(uid: String, key: String) {
136-
val updates: MutableMap<String, Any> = HashMap()
137-
updates["posts/$key/stars/$uid"] = true
138-
updates["posts/$key/starCount"] = ServerValue.increment(1)
139-
updates["user-posts/$uid/$key/stars/$uid"] = true
140-
updates["user-posts/$uid/$key/starCount"] = ServerValue.increment(1)
136+
val updates: MutableMap<String, Any> = hashMapOf(
137+
"posts/$key/stars/$uid" to true,
138+
"posts/$key/starCount" to ServerValue.increment(1),
139+
"user-posts/$uid/$key/stars/$uid" to true,
140+
"user-posts/$uid/$key/starCount" to ServerValue.increment(1)
141+
)
141142
database.updateChildren(updates)
142143
}
143144
// [END post_stars_increment]

0 commit comments

Comments
 (0)