Nick Halase
07/06/2022, 6:43 PMval values = listOf("name", "ASC", "description", "DESC")
val propNames = values.filterIndexed { index, _ -> index.mod(2) == 0 }
val sortDirections = values.filterIndexed { index, _ -> index.mod(2) != 0 }
propNames zip sortDirections // [(name, ASC), (description, DESC)]
ephemient
07/06/2022, 6:48 PMvalues.chunked(2) { (k, v) -> k to v }
or .windowed(2, 2)
if you want to ignore odd-length inputs instead of crashingNick Halase
07/06/2022, 6:50 PM