splice

fun <T> splice(original: List<T>, replacements: Map<List<Int>, List<T>>): List<T>

Puts each rescued row's lines in place of that row's fragments: the replacement goes where the row's first fragment was, its other fragments are dropped, every other item stays as it was. A row with no replacement (or an empty one) is left untouched.