I have a Map of Int->List[Int], and given a value I want to check if it already has an entry. If so, add to the list. Otherwise, create a new list and add to it. Is there a shorter way to do this?
def map = [:]
(1..100).each { i ->
if (map[i % 10] == null) {
map[i % 10] = []
}
map[i % 10].add(i)
}