how can I improve this snippet ? I would like to a...
# codereview
e
how can I improve this snippet ? I would like to avoid creating the list a priori and using 2 for each.
Copy code
class Person

class Goal(val assignees: List<Person>)

class GoalAssignation(val goal: Goal, val assignee: Person)

fun main(args: Array<String>) {
    val goalAssignations: MutableList<GoalAssignation> = ArrayList()
    val goals = goalRepository.findAll()
    goals.forEach { goal -> goal.assignees.forEach { assignee -> goalAssignations.add(GoalAssignation(goal, assignee)) } }
}