We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
// User data class User(val name: String, val age: Int) // UserManagementSystem class UserManagementSystem { val users = mutableListOf<User>() fun addUser(name: String, age: Int) { users.add(User(name, age)) } fun List<User>.filterAdults() = filter { it.age >= 18 } fun processUsers(action: (List<User>) -> Unit) { action(users) } fun getAdultUsers() = users.filterAdults() fun printUserNames() = processUsers { userList -> userList.forEach { println(it.name) } } fun calculateAverageAge() = users.map { it.age }.average() }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: