Examveda

You would like to group a list of students by last name and get the total number of groups. Which line of code accomplishes this, assuming you have a list of the Student data class? Data class Student(val firstName: String, val lastName: String)

A. Println(students.groupBy{ it.lastName }.count())

B. Println(students.groupBy{ it.lastName.first() }.fold().count())

C. Delegates.rx()

D. Println(students.groupingBy{ it.lastName.first() }.size())

Answer: Option A


This Question Belongs to Computer Science >> Kotlin Program

Join The Discussion

Related Questions on Kotlin Program

What is Kotlin?

A. A new version of Java.

B. A JavaScript framework.

C. A statically-typed programming language for the JVM, Android, and browser.

D. A database management system.