Skip to content

Instantly share code, notes, and snippets.

@ha-yi
Created June 12, 2017 20:10
Show Gist options
  • Select an option

  • Save ha-yi/2cc49b441a2dcf19b9dd343daea22b74 to your computer and use it in GitHub Desktop.

Select an option

Save ha-yi/2cc49b441a2dcf19b9dd343daea22b74 to your computer and use it in GitHub Desktop.
inline fun <reified T, Y> MutableList<T>.listOfField(property: KMutableProperty1<T, Y?>):MutableList<Y> {
val yy = ArrayList<Y>()
this.forEach { t: T ->
yy.add(property.get(t) as Y)
}
return yy
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment