``` val statusMap = mutableMapOf( nore...
# getting-started
o
Copy code
val statusMap = mutableMapOf(
            noreply to 0, contacted to 0, finished to 0,
            negotiating to 0, sold to 0, notContacted to 0
        )

        searchResults.forEach {
            if (statusMap.containsKey(it.state)) {
                statusMap[it.state] = statusMap.getValue(it.state) + 1
            }
        }
l
for this specific case:
Copy code
val statusMap = searchResults.asSequence().map { it.state }.groupingBy { it }.eachCount()
is another approach, although it may miss the keys that are not present in the searchResults