Search for a car by brand

Report a typo

Suppose your customer has a car dealership that sells cars of various brands.

data class Car(val brand: String, val model: String, val year: Int, val price: Double)

He wants you to write a function that accepts a list of cars and a brand for entry and then filters the list, leaving only the cars of the given brand. To do that, use an inline function.

Write a program in Kotlin
data class Car(val brand: String, val model: String, val year: Int, val price: Double)

/*?*/filterByBrand(cars: List<Car>, brand: String): List<Car> {
// make your code here
}
___

Create a free account to access the full topic