Considering this piece of Kotlin code, that collects all declared fields in superclass hierarchy, is there way to write it using functional programming?
var scanClass: Class<*>? = someClass
val fields = mutableListOf<Field>()
while (scanClass != null) {
fields += scanClass.declaredFields
scanClass = scanClass.superclass
}
Aucun commentaire:
Enregistrer un commentaire