Skip to content

Commit

Permalink
Assign values before executing lambda
Browse files Browse the repository at this point in the history
- Ensures that the values have not mutated when executing the lambda
  • Loading branch information
mofojed committed Jan 12, 2024
1 parent 90805c6 commit 5a0c4e5
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,15 @@ public Promise<JsTable> getTable(Object key) {
// key doesn't even exist, just hand back a null table
return Promise.resolve((JsTable) null);
}
final String[] columnNames = descriptor.getKeyColumnNamesList().asArray(new String[0]);
final String[] columnTypes = keyColumnTypes.toArray(new String[0]);
final Object[][] keysData = keyList.stream().map(item -> new Object[] {item}).toArray(Object[][]::new);
final ClientTableState entry = connection.newState((c, cts, metadata) -> {
// TODO deephaven-core#2529 parallelize this
connection.newTable(
descriptor.getKeyColumnNamesList().asArray(new String[0]),
keyColumnTypes.toArray(new String[0]),
keyList.stream().map(item -> new Object[] {item}).toArray(Object[][]::new),
columnNames,
columnTypes,
keysData,
null,
this)
.then(table -> {
Expand Down

0 comments on commit 5a0c4e5

Please sign in to comment.