replaceWithSeveral

fun Node.replaceWithSeveral(oldNode: Node, newNodes: List<Node>)

Looks for oldNode in the lists of nodes in this node. When found, it is removed, and in its place the newNodes are inserted. When not found, an IllegalStateException is thrown.


Replaces this node with any amount of other nodes if it is in a MutableList.

Looks for [this] in the lists of nodes in the parent node. When found, [this] is removed, and in its place [newNodes] are inserted. For this to work, [Node.assignParents] must have been called.
fun <T> MutableList<T>.replaceWithSeveral(index: Int, replacements: List<T>)

Replaces the element at index with replacements.