[
https://issues.apache.org/jira/browse/TAJO-2058?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15198671#comment-15198671
]
ASF GitHub Bot commented on TAJO-2058:
--------------------------------------
Github user eminency commented on a diff in the pull request:
https://github.com/apache/tajo/pull/944#discussion_r56449935
--- Diff:
tajo-core-tests/src/test/java/org/apache/tajo/client/TestTajoClient.java ---
@@ -175,10 +176,8 @@ public final void testSessionVariables() throws
IOException, TajoException, Inte
String prefixName = "key_";
String prefixValue = "val_";
- List<String> unsetList = new ArrayList<>();
- for(Map.Entry<String, String> entry:
client.getAllSessionVariables().entrySet()) {
- unsetList.add(entry.getKey());
- }
+ List<String> unsetList =
client.getAllSessionVariables().entrySet().stream()
+ .map(Map.Entry<String, String>::getKey).collect(Collectors.toList());
--- End diff --
I think next one is more readable:
```java
List<String> unsetList = new
ArrayList<>(client.getAllSessionVariables().keySet());
```
> foreach loop can be collapsed with stream api
> ---------------------------------------------
>
> Key: TAJO-2058
> URL: https://issues.apache.org/jira/browse/TAJO-2058
> Project: Tajo
> Issue Type: Improvement
> Reporter: Dongkyu Hwangbo
> Assignee: Dongkyu Hwangbo
> Priority: Minor
> Labels: migration, stream
>
> Currently, TAJO has many foreach loop. To make project more stream-friendly,
> replacing this loop with stream api is needed.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)