You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@tajo.apache.org by dkhwangbo <gi...@git.apache.org> on 2015/11/09 08:24:06 UTC

[GitHub] tajo pull request: TAJO-1973: Replace 'while' loop with 'foreach'

GitHub user dkhwangbo opened a pull request:

    https://github.com/apache/tajo/pull/858

    TAJO-1973: Replace 'while' loop with 'foreach'

    'While' loops which iterate over collections can be replaced with the 'foreach' iteration syntax, which is available in Java 5 and newer.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/dkhwangbo/tajo TAJO-1973

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/tajo/pull/858.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #858
    
----
commit f4cee94de68bf3662c8f42056e70591d421fc619
Author: Dongkyu Hwangbo <hw...@gmail.com>
Date:   2015-11-09T07:12:33Z

    initial commit

commit ce3037ad54fe062f0ddb1c62d1bee6ec89b94a90
Author: Dongkyu Hwangbo <hw...@gmail.com>
Date:   2015-11-09T07:21:15Z

    keep align

commit 65cc4c51ea39730924b5c1f6fe6619b903e7bab6
Author: Dongkyu Hwangbo <hw...@gmail.com>
Date:   2015-11-09T07:22:51Z

    keep align

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] tajo pull request: TAJO-1973: Replace 'while' loop with 'foreach'

Posted by dkhwangbo <gi...@git.apache.org>.
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? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] tajo pull request: TAJO-1973: Replace 'while' loop with 'foreach'

Posted by jihoonson <gi...@git.apache.org>.
Github user jihoonson commented on a diff in the pull request:

    https://github.com/apache/tajo/pull/858#discussion_r46115892
  
    --- 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 --
    
    Creation of this array list looks redundant.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] tajo pull request: TAJO-1973: Replace 'while' loop with 'foreach'

Posted by eminency <gi...@git.apache.org>.
Github user eminency commented on the pull request:

    https://github.com/apache/tajo/pull/858#issuecomment-160504248
  
    +1


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] tajo pull request: TAJO-1973: Replace 'while' loop with 'foreach'

Posted by jihoonson <gi...@git.apache.org>.
Github user jihoonson commented on the pull request:

    https://github.com/apache/tajo/pull/858#issuecomment-163131941
  
    +1 LGTM


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] tajo pull request: TAJO-1973: Replace 'while' loop with 'foreach'

Posted by jihoonson <gi...@git.apache.org>.
Github user jihoonson commented on a diff in the pull request:

    https://github.com/apache/tajo/pull/858#discussion_r47055756
  
    --- 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 --
    
    Right. My misunderstanding.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] tajo pull request: TAJO-1973: Replace 'while' loop with 'foreach'

Posted by dkhwangbo <gi...@git.apache.org>.
Github user dkhwangbo commented on a diff in the pull request:

    https://github.com/apache/tajo/pull/858#discussion_r46547915
  
    --- 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 --
    
    Oh, I found that my above comment has no relation about this issue.
    Creation of this array is needed because of 284 line in same file.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] tajo pull request: TAJO-1973: Replace 'while' loop with 'foreach'

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/tajo/pull/858


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---