Either `list.associate { key to value }` or `list....
# announcements
d
Either
list.associate { key to value }
or
list.associateBy { key }
👍 1
e
Any way I can shorten this by using something else at the
partition
step?
Copy code
val properties = FiledOrder::class.declaredMemberProperties
    val parts = properties.partition { it.findAnnotation<FiledOrder.Order>() != null }
    val plain = parts.first.sortedBy { it.name }
    val annotated = parts.second.associateBy { it.findAnnotation<FiledOrder.Order>()!!.value }
I want to have a list of properties without the given annotation, and I want a map of the others, using the annotation
value
as key
Copy code
class FiledOrder {
    @Retention(AnnotationRetention.RUNTIME)
    annotation class Order(val value: Int)
d
I can't find anything shorter right now tbh. Looks okay
e
ok