oday
02/02/2018, 10:47 AMval 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
}
}
leodeng
02/02/2018, 2:45 PMval 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