toBuilder

Converts this SudokuSchemas instance into a Builder object.

This method creates a new Builder instance and initializes it with the schemas from this SudokuSchemas. The returned builder can be used to add, remove, or modify schemas and then build a new SudokuSchemas if needed.

Example:

val existingSet = SudokuSchemas(
listOf(
SudokuSchema(
puzzle = SudokuString("A1B2..."),
solution = SudokuString("1A2B..."),
difficulty = Difficulty.MEDIUM,
sudokuType = SudokuType.Sudoku4x4
)
)
)

// Convert to a builder
val builder = existingSet.toBuilder()

// Add a new schema to the builder
builder.add(SudokuSchema(
puzzle = SudokuString("B1C2..."),
solution = SudokuString("2B3C..."),
difficulty = Difficulty.HARD,
sudokuType = SudokuType.Sudoku4x4
))

// Build a new SudokuSchemas with the modified schemas
val newSet = builder.build()

Return

A Builder initialized with the schemas from this SudokuSchemas.