diff --git a/firebase-dataconnect/src/main/kotlin/com/google/firebase/dataconnect/util/NullableReference.kt b/firebase-dataconnect/src/main/kotlin/com/google/firebase/dataconnect/util/NullableReference.kt index 9a67442e263..ed9b9da8ee2 100644 --- a/firebase-dataconnect/src/main/kotlin/com/google/firebase/dataconnect/util/NullableReference.kt +++ b/firebase-dataconnect/src/main/kotlin/com/google/firebase/dataconnect/util/NullableReference.kt @@ -15,7 +15,12 @@ */ package com.google.firebase.dataconnect.util -internal class NullableReference(val ref: T? = null) { +/** + * A class that simply wraps a reference to another object, possibly a null reference. Instances of + * this class can be useful for the case where the meaning of `null` is overloaded, such as + * [kotlinx.coroutines.flow.MutableStateFlow.compareAndSet]. + */ +internal class NullableReference(val ref: T? = null) { override fun equals(other: Any?) = (other is NullableReference<*>) && other.ref == ref override fun hashCode() = ref?.hashCode() ?: 0 override fun toString() = ref?.toString() ?: "null"