snuyanzin commented on code in PR #27:
URL:
https://github.com/apache/flink-connector-hbase/pull/27#discussion_r1356560575
##########
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 think there is no need for a new arrayList, we can just reuse `result`
Anyway I would suggest to use java's `StreamSupport`, it will allow to
minimize amount of changes
the whole code block could look like
```java
List<String> result = StreamSupport.stream(
Spliterators.spliteratorUnknownSize(tableResult3.collect(),
Spliterator.ORDERED),
false)
.map(Row::toString)
.sorted()
.collect(Collectors.toList());
```
--
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]