Tuang
12/26/2019, 10:03 AMval topStudents = arrayOf("Jake", "Jesse", "Matt", "Alec")
names.forEach { println(it) }
but how to do in this condition.
val allStudents = setOf {
"Michael",
"Kim",
topStudents <= i don't know how to retrieve topStudent each names likes "Michael" and "Kim"
}
// the result what i want is
val allStudents = setOf {
"Michael",
"Kim",
"Jake",
"Jesse",
"Matt",
"Alec"
}
Ivan Kubyshkin [JetBrains]
12/26/2019, 10:06 AMval topStudents = arrayOf("Jake", "Jesse", "Matt", "Alec")
val allStudents = setOf(
"Michael",
"Kim"
) + topStudents.toSet()
allStudents.forEach { println(it) }
Tuang
12/26/2019, 10:14 AMbezrukov
12/26/2019, 10:23 AM.toSet()
is not necessary for topStudents
, it can be just
val allStudents = setOf(
"Michael",
"Kim"
) + topStudents
Dico
12/26/2019, 12:20 PMsetOf(
"Michael",
"Kim",
*topStudents
)