We read your photo as:
Which Kotlin collection function is used to create a new collection containing only the elements that satisfy a given condition?
Computer Science
ScanSolve AI Answer
Answer
The correct option is filter().
In Kotlin, the filter() function is used to create a new collection containing only the elements from the original collection that satisfy a given predicate (a boolean-valued function or condition).
sort()is used to sort the elements of a collection.map()is used to transform each element of a collection into a new form.reduce()is used to combine all elements of a collection into a single result.
The final answer is
Was this helpful?
Try one yourself
A new problem that tests the same skill.
Still stuck on this one?
Ask a follow-up, and the answer starts from this question.
Got a different question?Ask your own question
More Computer Science Questions
QWhich Kotlin function allows you to filter elements of a collection based on a specified condition.QTo identify the Kotlin feature that allows for more compact function declarations by omitting curly…QTo choose the best description of a 'function' in Kotlin.QWhich of the following is a basic data type in Kotlin?QIn Kotlin, how do you declare a variable that cannot be reassigned after it is initialized?