````companion object { val SORTING_COLUMNS = m...
# announcements
u
Copy code
`companion object {
    val SORTING_COLUMNS = mapOf(X to "Y")
    val DEFAULT_SORTING_COLUMN: String = SORTING_COLUMNS[X]!!
}`
Anything I could do here to avoid reductant
!!
?
w
Copy code
SORTING_COLUMNS.getValue(X)
?
u
@wbertan Perfect
v
[X]
translates to
.get(X)
wich returns
T?
and the compile cannot know what is insider your map.
mapOf
could also return a map that returns a value on even seconds and
null
on odd seconds. So only with
getValue
, yep ­čÖé
­čĹŹ 1
n
getValue is longer obviously but if I'm going to !! immediately I always use it; you get a better exception if the key is missing