marcinmoskala
02/18/2017, 11:33 AMfun <T> List<List<T>>.transpose(empty: T): List<List<T>> {
if (isEmpty()) return this
val maxRowCount = map { it.size }.max()!!
return (0..maxRowCount - 1).map { indices.map { j -> get(j).getOrElse(it) { empty } } }
}