copy

abstract fun copy(changes: Map<Grid.Address, Grid.State> = emptyMap()): Grid

Returns a new, modified instance of this Grid if changes actually causes any changes.

If the map is non-empty and causes no changes at all, the same Grid instance is returned. If the map is empty, an exact copy is returned as a new instance.

Invalid Addresses will cause Exceptions. See isValidAddress.


abstract fun copy(address: Grid.Address, change: Grid.State): Grid

Returns a modified copy of this Grid if change actually causes a change.

If it does not cause a change, the same instance is returned.

Invalid Addresses will cause Exceptions. See isValidAddress.