Skip to content

Commit

Permalink
Add new replaceColumn method (jtablesaw#673)
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann authored and lwhite1 committed Sep 29, 2019
1 parent 9cccfa4 commit a48fea2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 9 additions & 0 deletions core/src/main/java/tech/tablesaw/api/Table.java
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,15 @@ public Table replaceColumn(final String columnName, final Column<?> newColumn) {
return replaceColumn(colIndex, newColumn);
}

/**
* Replaces an existing column having the same name of the given column with the given column
*
* @param newColumn Column to be added
*/
public Table replaceColumn(Column<?> newColumn) {
return replaceColumn(newColumn.name(), newColumn);
}

/** Sets the name of the table */
@Override
public Table setName(String name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,5 +146,4 @@ public StringColumn asStringColumn() {
}
return sc;
}

}

0 comments on commit a48fea2

Please sign in to comment.