diff --git a/src/main/java/com/widen/tabitha/Row.java b/src/main/java/com/widen/tabitha/Row.java index a355920..193f078 100644 --- a/src/main/java/com/widen/tabitha/Row.java +++ b/src/main/java/com/widen/tabitha/Row.java @@ -11,6 +11,20 @@ public class Row implements Iterable { private final Row.Cell[] cells; + /** + * Create a copy of a row. + *

+ * This is not a deep copy, as a deep copy is not necessary. Since cells are immutable, columns and values can be + * reused without copying. Setting a new value will lazily create a new cell instance. + * + * @param row The row to copy. + * @return A copy of the row. + */ + public static Row copyOf(Row row) + { + return new Row(Arrays.copyOf(row.cells, row.cells.length)); + } + /** * Create a new row that merges the columns and values of all the given rows. *