I have such kotlin code. I didn't write it very elegantly, but it works correctly. How can I write this more beautifully using kotlin tools?
I need to apply all elements from the filters list to the query object.
fun create(filters: List<FilterFactory.Filter>, searchQuery: SearchQuery): Query {
var query = Query()
filters.forEach { filter -> query = filter.apply(query) }
return query
}