I have a data class "Sample" and wanted to collect all the values that are not null, in this case the result should be "name and "type". How to iterate over the data class members without reflection?
data class Sample(
var name: String = "abc",
var model: String? = null,
var color: String? = null,
var type: String? = "xyz",
var manufacturer: String? = null
) : Serializable
question from:https://stackoverflow.com/questions/65894295/get-all-properties-from-data-class-that-are-not-null-in-kotlin