You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@tajo.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2015/12/03 09:36:10 UTC
[jira] [Commented] (TAJO-1973) Replace 'while' loop with 'foreach'
[ https://issues.apache.org/jira/browse/TAJO-1973?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15037487#comment-15037487 ]
ASF GitHub Bot commented on TAJO-1973:
--------------------------------------
Github user dkhwangbo commented on a diff in the pull request:
https://github.com/apache/tajo/pull/858#discussion_r46524585
--- Diff: tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalog.java ---
@@ -274,10 +274,8 @@ public void testDropDatabaseWithAllTables() throws Exception {
Map<String, List<String>> createdTablesMap = createBaseDatabaseAndTables();
// Each time we drop one database, check all databases and their tables.
- Iterator<String> it = new ArrayList<>(createdTablesMap.keySet()).iterator();
- while(it.hasNext()) {
+ for (String databaseName : new ArrayList<>(createdTablesMap.keySet())) {
--- End diff --
Thanks for your reply.
As my understanding, That line is written to convert Set to List because Set has no ordering. I have no idea with another way to get same result. Can I get some more details about your comment?
> Replace 'while' loop with 'foreach'
> -----------------------------------
>
> Key: TAJO-1973
> URL: https://issues.apache.org/jira/browse/TAJO-1973
> Project: Tajo
> Issue Type: Improvement
> Reporter: Dongkyu Hwangbo
> Assignee: Dongkyu Hwangbo
> Priority: Trivial
> Labels: newbie
>
> 'While' loops which iterate over collections can be replaced with the 'foreach' iteration syntax, which is available in Java 5 and newer.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)