ferenc-csaky commented on code in PR #27:
URL:
https://github.com/apache/flink-connector-hbase/pull/27#discussion_r1356574049
##########
flink-connector-hbase-2.2/src/test/java/org/apache/flink/connector/hbase2/HBaseConnectorITCase.java:
##########
@@ -384,11 +383,13 @@ public void testTableSourceSinkWithDDL() throws Exception
{
TableResult tableResult3 = batchEnv.executeSql(query);
- List<String> result =
- Lists.newArrayList(tableResult3.collect()).stream()
- .map(Row::toString)
- .sorted()
- .collect(Collectors.toList());
+ List<String> result = new ArrayList<>();
+ for (CloseableIterator<Row> it = tableResult3.collect(); it.hasNext();
) {
+ Row row = it.next();
+ result.add(row.toString());
+ }
+ Collections.sort(result);
+ result = new ArrayList<>(result);
Review Comment:
I agree with @snuyanzin about the second deep copy. Furthermore, the most
clean solution IMO would be this:
```java
List<String> result = new ArrayList<>();
tableResult3.collect().forEachRemaining(r -> result.add(r.toString()));
Collections.sort(result);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]