ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Ant.ja va AntStructure.java Concat.java Copydir.java Expand.java Jar.java Javado c.java Replace.java UpToDate.java Zip.java
Date Wed, 13 Aug 2003 15:01:21 GMT
FWIW, I personally find it better to scope the Iterator or Enumeration by
using a for-loop rather than a while-loop. So instead of:

    Enumeration e = props.propertyNames();
    while (e.hasMoreElements()) {
        String name = (String) e.nextElement();
        String className = props.getProperty(name);
        ...
    }

one gets:

    for (Enumeration e = props.propertyNames(); e.hasMoreElements();) {
        String name = (String) e.nextElement();
        String className = props.getProperty(name);
        ...
    }

The Java Programming Language book does it like that. --DD

> -----Original Message-----
> From: peterreilly@apache.org [mailto:peterreilly@apache.org]
> Sent: Wednesday, August 13, 2003 9:46 AM
> To: ant-cvs@apache.org
> Subject: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Ant.java
> AntStructure.java Concat.java Copydir.java Expand.java Jar.java
> Javadoc.java Replace.java UpToDate.java Zip.java
> 
> peterreilly    2003/08/13 07:46:15
> 
>   Modified:    src/main/org/apache/tools/ant ComponentHelper.java
>                         RuntimeConfigurable.java Task.java
>                src/main/org/apache/tools/ant/input
> DefaultInputHandler.java
>                src/main/org/apache/tools/ant/taskdefs Ant.java
>                         AntStructure.java Concat.java Copydir.java
>                         Expand.java Jar.java Javadoc.java Replace.java
>                         UpToDate.java Zip.java
>   Log:
>   removing enum variable
>   PR: 22345
> 
>   Revision  Changes    Path
>   1.23      +6 -6
> ant/src/main/org/apache/tools/ant/ComponentHelper.java
> 
>   Index: ComponentHelper.java
>   ===================================================================
>   RCS file:
> /home/cvs/ant/src/main/org/apache/tools/ant/ComponentHelper.java,v
>   retrieving revision 1.22
>   retrieving revision 1.23
>   diff -u -r1.22 -r1.23
>   --- ComponentHelper.java	13 Aug 2003 14:06:19 -0000	1.22
>   +++ ComponentHelper.java	13 Aug 2003 14:46:15 -0000	1.23
>   @@ -746,9 +746,9 @@
>                }
>                props.load(in);
> 
>   -            Enumeration enum = props.propertyNames();
>   -            while (enum.hasMoreElements()) {
>   -                String name = (String) enum.nextElement();
>   +            Enumeration e = props.propertyNames();
>   +            while (e.hasMoreElements()) {
>   +                String name = (String) e.nextElement();
>                    String className = props.getProperty(name);
>                    AntTypeDefinition def = new AntTypeDefinition();
>                    def.setName(name);
...

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message