commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ebo...@apache.org
Subject svn commit: r627984 [1/2] - in /commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2: ./ beanutils/ plist/ tree/ tree/xpath/ web/
Date Fri, 15 Feb 2008 09:46:14 GMT
Author: ebourg
Date: Fri Feb 15 01:46:09 2008
New Revision: 627984

URL: http://svn.apache.org/viewvc?rev=627984&view=rev
Log:
More generification of the code
Modified several loops in the code to use the foreach construct

Modified:
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractFileConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractHierarchicalFileConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/CombinedConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/CompositeConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationFactory.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationKey.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationMap.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationUtils.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DataConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DefaultConfigurationBuilder.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/HierarchicalConfigurationConverter.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/INIConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/JNDIConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/MapConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/PrefixedKeysIterator.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/SubnodeConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/XMLConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/beanutils/XMLBeanDeclaration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/XMLPropertyListConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/ConfigurationNode.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/DefaultConfigurationKey.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/DefaultConfigurationNode.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/DefaultExpressionEngine.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/NodeCombiner.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/OverrideCombiner.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/UnionCombiner.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/ViewNode.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodeIteratorAttribute.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodeIteratorBase.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodeIteratorChildren.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodePointer.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/ConfigurationNodePointerFactory.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/xpath/XPathExpressionEngine.java
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/web/BaseWebConfiguration.java

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractFileConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractFileConfiguration.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractFileConfiguration.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractFileConfiguration.java Fri Feb 15 01:46:09 2008
@@ -934,7 +934,7 @@
         return super.containsKey(key);
     }
 
-    public Iterator getKeys()
+    public Iterator<String> getKeys()
     {
         reload();
         return super.getKeys();

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractHierarchicalFileConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractHierarchicalFileConfiguration.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractHierarchicalFileConfiguration.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/AbstractHierarchicalFileConfiguration.java Fri Feb 15 01:46:09 2008
@@ -30,6 +30,7 @@
 import org.apache.commons.configuration2.event.ConfigurationEvent;
 import org.apache.commons.configuration2.event.ConfigurationListener;
 import org.apache.commons.configuration2.reloading.ReloadingStrategy;
+import org.apache.commons.configuration2.tree.ConfigurationNode;
 
 /**
  * <p>Base class for implementing file based hierarchical configurations.</p>
@@ -308,7 +309,7 @@
         return super.containsKey(key);
     }
 
-    public Iterator getKeys(String prefix)
+    public Iterator<String> getKeys(String prefix)
     {
         reload();
         return super.getKeys(prefix);
@@ -334,7 +335,7 @@
      * @param nodes a collection with the nodes to be added
      * @since 1.5
      */
-    public void addNodes(String key, Collection nodes)
+    public void addNodes(String key, Collection<? extends ConfigurationNode> nodes)
     {
         super.addNodes(key, nodes);
         delegate.possiblySave();
@@ -347,7 +348,7 @@
      * @param key the key
      * @return a list with the selected nodes
      */
-    protected List fetchNodeList(String key)
+    protected List<ConfigurationNode> fetchNodeList(String key)
     {
         reload();
         return super.fetchNodeList(key);

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/CombinedConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/CombinedConfiguration.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/CombinedConfiguration.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/CombinedConfiguration.java Fri Feb 15 01:46:09 2008
@@ -195,10 +195,10 @@
     private ConfigurationNode combinedRoot;
 
     /** Stores a list with the contained configurations. */
-    private List configurations;
+    private List<ConfigData> configurations;
 
     /** Stores a map with the named configurations. */
-    private Map namedConfigurations;
+    private Map<String, Configuration> namedConfigurations;
 
     /** A flag whether an enhanced reload check is to be performed.*/
     private boolean forceReloadCheck;
@@ -513,8 +513,8 @@
     public void clear()
     {
         fireEvent(EVENT_CLEAR, null, null, true);
-        configurations = new ArrayList();
-        namedConfigurations = new HashMap();
+        configurations = new ArrayList<ConfigData>();
+        namedConfigurations = new HashMap<String, Configuration>();
         fireEvent(EVENT_CLEAR, null, null, false);
         invalidate();
     }
@@ -608,23 +608,20 @@
             throw new IllegalArgumentException("Key must not be null!");
         }
 
-        List nodes = fetchNodeList(key);
+        List<ConfigurationNode> nodes = fetchNodeList(key);
         if (nodes.isEmpty())
         {
             return null;
         }
 
-        Iterator it = nodes.iterator();
-        Configuration source = findSourceConfiguration((ConfigurationNode) it
-                .next());
+        Iterator<ConfigurationNode> it = nodes.iterator();
+        Configuration source = findSourceConfiguration(it.next());
         while (it.hasNext())
         {
-            Configuration src = findSourceConfiguration((ConfigurationNode) it
-                    .next());
+            Configuration src = findSourceConfiguration(it.next());
             if (src != source)
             {
-                throw new IllegalArgumentException("The key " + key
-                        + " is defined by multiple sources!");
+                throw new IllegalArgumentException("The key " + key + " is defined by multiple sources!");
             }
         }
 
@@ -701,7 +698,7 @@
         private String name;
 
         /** Stores the at information as path of nodes. */
-        private Collection atPath;
+        private Collection<String> atPath;
 
         /** Stores the at string.*/
         private String at;
@@ -781,10 +778,10 @@
             if (atPath != null)
             {
                 // Build the complete path
-                for (Iterator it = atPath.iterator(); it.hasNext();)
+                for (String name : atPath)
                 {
                     ViewNode node = new ViewNode();
-                    node.setName((String) it.next());
+                    node.setName(name);
                     atParent.addChild(node);
                     atParent = node;
                 }
@@ -806,16 +803,15 @@
          * @param at the at string
          * @return a collection with the names of the single components
          */
-        private Collection parseAt(String at)
+        private Collection<String> parseAt(String at)
         {
             if (at == null)
             {
                 return null;
             }
 
-            Collection result = new ArrayList();
-            DefaultConfigurationKey.KeyIterator it = new DefaultConfigurationKey(
-                    AT_ENGINE, at).iterator();
+            Collection<String> result = new ArrayList<String>();
+            DefaultConfigurationKey.KeyIterator it = new DefaultConfigurationKey(AT_ENGINE, at).iterator();
             while (it.hasNext())
             {
                 result.add(it.nextKey());

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/CompositeConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/CompositeConfiguration.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/CompositeConfiguration.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/CompositeConfiguration.java Fri Feb 15 01:46:09 2008
@@ -35,11 +35,10 @@
  * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
  * @version $Id$
  */
-public class CompositeConfiguration extends AbstractConfiguration
-implements Cloneable
+public class CompositeConfiguration extends AbstractConfiguration implements Cloneable
 {
     /** List holding all the configuration */
-    private List configList = new LinkedList();
+    private List<Configuration> configList = new LinkedList<Configuration>();
 
     /**
      * Configuration that holds in memory stuff.  Inserted as first so any
@@ -76,7 +75,7 @@
      *
      * @param configurations the collection of configurations to add
      */
-    public CompositeConfiguration(Collection configurations)
+    public CompositeConfiguration(Collection<Configuration> configurations)
     {
         this(new BaseConfiguration(), configurations);
     }
@@ -88,16 +87,15 @@
      * @param inMemoryConfiguration the in memory configuration to use
      * @param configurations        the collection of configurations to add
      */
-    public CompositeConfiguration(Configuration inMemoryConfiguration, Collection configurations)
+    public CompositeConfiguration(Configuration inMemoryConfiguration, Collection<Configuration> configurations)
     {
         this(inMemoryConfiguration);
 
         if (configurations != null)
         {
-            Iterator it = configurations.iterator();
-            while (it.hasNext())
+            for (Configuration configuration : configurations)
             {
-                addConfiguration((Configuration) it.next());
+                addConfiguration(configuration);
             }
         }
     }
@@ -204,17 +202,15 @@
         }
     }
 
-    public Iterator getKeys()
+    public Iterator<String> getKeys()
     {
-        List keys = new ArrayList();
-        for (Iterator i = configList.iterator(); i.hasNext();)
+        List<String> keys = new ArrayList<String>();
+        for (Configuration config : configList)
         {
-            Configuration config = (Configuration) i.next();
-
-            Iterator j = config.getKeys();
+            Iterator<String> j = config.getKeys();
             while (j.hasNext())
             {
-                String key = (String) j.next();
+                String key = j.next();
                 if (!keys.contains(key))
                 {
                     keys.add(key);
@@ -225,13 +221,11 @@
         return keys.iterator();
     }
 
-    public Iterator getKeys(String key)
+    public Iterator<String> getKeys(String key)
     {
-        List keys = new ArrayList();
-        for (Iterator i = configList.iterator(); i.hasNext();)
+        List<String> keys = new ArrayList<String>();
+        for (Configuration config : configList)
         {
-            Configuration config = (Configuration) i.next();
-
             Iterator j = config.getKeys(key);
             while (j.hasNext())
             {
@@ -283,15 +277,15 @@
         return false;
     }
 
-    public List getList(String key, List defaultValue)
+    public <T> List<T> getList(String key, List<T> defaultValue)
     {
         List list = new ArrayList();
 
         // add all elements from the first configuration containing the requested key
-        Iterator it = configList.iterator();
+        Iterator<Configuration> it = configList.iterator();
         while (it.hasNext() && list.isEmpty())
         {
-            Configuration config = (Configuration) it.next();
+            Configuration config = it.next();
             if (config != inMemoryConfiguration && config.containsKey(key))
             {
                 list.addAll(config.getList(key));
@@ -369,7 +363,7 @@
             CompositeConfiguration copy = (CompositeConfiguration) super
                     .clone();
             copy.clearConfigurationListeners();
-            copy.configList = new LinkedList();
+            copy.configList = new LinkedList<Configuration>();
             copy.inMemoryConfiguration = ConfigurationUtils
                     .cloneConfiguration(getInMemoryConfiguration());
             copy.configList.add(copy.inMemoryConfiguration);

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationFactory.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationFactory.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationFactory.java Fri Feb 15 01:46:09 2008
@@ -723,7 +723,7 @@
         private CompositeConfiguration config;
 
         /** Stores a collection with the configs from the additional section.*/
-        private Collection additionalConfigs;
+        private Collection<AdditionalConfigurationData> additionalConfigs;
 
         /**
          * Creates a new instance of <code>ConfigurationBuilder</code>.
@@ -731,7 +731,7 @@
         public ConfigurationBuilder()
         {
             config = new CompositeConfiguration();
-            additionalConfigs = new LinkedList();
+            additionalConfigs = new LinkedList<AdditionalConfigurationData>();
         }
 
         /**

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationKey.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationKey.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationKey.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationKey.java Fri Feb 15 01:46:09 2008
@@ -387,7 +387,7 @@
      * This class implements the normal iterator interface. In addition it
      * provides some specific methods for configuration keys.
      */
-    public class KeyIterator implements Iterator, Cloneable
+    public class KeyIterator implements Iterator<String>, Cloneable, Iterable<String>
     {
         /** Stores the current key name.*/
         private String current;
@@ -581,7 +581,7 @@
          *
          * @return the next object
          */
-        public Object next()
+        public String next()
         {
             return nextKey();
         }
@@ -672,6 +672,11 @@
                 // should not happen
                 return null;
             }
+        }
+
+        public Iterator<String> iterator()
+        {
+            return this;
         }
     }
 }

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationMap.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationMap.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationMap.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationMap.java Fri Feb 15 01:46:09 2008
@@ -35,7 +35,7 @@
  * @version $Revision$, $Date$
  * @since 1.0
  */
-public class ConfigurationMap extends AbstractMap
+public class ConfigurationMap extends AbstractMap<String, Object>
 {
     /**
      * The <code>Configuration</code> wrapped by this class.
@@ -71,7 +71,7 @@
      * @return a set with the contained entries
      * @see java.util.Map#entrySet()
      */
-    public Set entrySet()
+    public Set<Entry<String, Object>> entrySet()
     {
         return new ConfigurationSet(configuration);
     }
@@ -85,7 +85,7 @@
      * @return the old value of this key or <b>null</b> if it is new
      * @see java.util.Map#put(java.lang.Object, java.lang.Object)
      */
-    public Object put(Object key, Object value)
+    public Object put(String key, Object value)
     {
         String strKey = String.valueOf(key);
         Object old = configuration.getProperty(strKey);
@@ -109,7 +109,7 @@
     /**
      * Set of entries in the map.
      */
-    static class ConfigurationSet extends AbstractSet
+    static class ConfigurationSet extends AbstractSet<Entry<String, Object>>
     {
         /** The configuration mapped to this entry set. */
         private Configuration configuration;
@@ -117,30 +117,30 @@
         /**
          * A Map entry in the ConfigurationMap.
          */
-        private final class Entry implements Map.Entry
+        private final class Entry implements Map.Entry<String, Object>
         {
             /** The key of the map entry. */
-            private Object key;
+            private String key;
 
-            private Entry(Object key)
+            private Entry(String key)
             {
                 this.key = key;
             }
 
-            public Object getKey()
+            public String getKey()
             {
                 return key;
             }
 
             public Object getValue()
             {
-                return configuration.getProperty((String) key);
+                return configuration.getProperty(key);
             }
 
             public Object setValue(Object value)
             {
                 Object old = getValue();
-                configuration.setProperty((String) key, value);
+                configuration.setProperty(key, value);
                 return old;
             }
         }
@@ -148,10 +148,10 @@
         /**
          * Iterator over the entries in the ConfigurationMap.
          */
-        private final class ConfigurationSetIterator implements Iterator
+        private final class ConfigurationSetIterator implements Iterator<Map.Entry<String, Object>>
         {
             /** An iterator over the keys in the configuration. */
-            private Iterator keys;
+            private Iterator<String> keys;
 
             private ConfigurationSetIterator()
             {
@@ -163,7 +163,7 @@
                 return keys.hasNext();
             }
 
-            public Object next()
+            public Entry next()
             {
                 return new Entry(keys.next());
             }
@@ -197,7 +197,7 @@
         /**
          * @see java.util.Collection#iterator()
          */
-        public Iterator iterator()
+        public Iterator<Map.Entry<String, Object>> iterator()
         {
             return new ConfigurationSetIterator();
         }

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationUtils.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationUtils.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/ConfigurationUtils.java Fri Feb 15 01:46:09 2008
@@ -254,14 +254,12 @@
         {
             try
             {
-                Method m = obj.getClass().getMethod(METHOD_CLONE, null);
-                return m.invoke(obj, null);
+                Method m = obj.getClass().getMethod(METHOD_CLONE);
+                return m.invoke(obj);
             }
             catch (NoSuchMethodException nmex)
             {
-                throw new CloneNotSupportedException(
-                        "No clone() method found for class"
-                                + obj.getClass().getName());
+                throw new CloneNotSupportedException("No clone() method found for class" + obj.getClass().getName());
             }
             catch (IllegalAccessException iaex)
             {
@@ -274,8 +272,7 @@
         }
         else
         {
-            throw new CloneNotSupportedException(obj.getClass().getName()
-                    + " does not implement Cloneable");
+            throw new CloneNotSupportedException(obj.getClass().getName() + " does not implement Cloneable");
         }
     }
 
@@ -697,8 +694,7 @@
     {
         if (!(src instanceof EventSource))
         {
-            throw new IllegalArgumentException(
-                    "Configuration must be derived from EventSource!");
+            throw new IllegalArgumentException("Configuration must be derived from EventSource!");
         }
         ((EventSource) src).addErrorListener(new ConfigurationErrorListener()
         {

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DataConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DataConfiguration.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DataConfiguration.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DataConfiguration.java Fri Feb 15 01:46:09 2008
@@ -155,7 +155,7 @@
         configuration.clearProperty(key);
     }
 
-    public Iterator getKeys()
+    public Iterator<String> getKeys()
     {
         return configuration.getKeys();
     }

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DefaultConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DefaultConfigurationBuilder.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DefaultConfigurationBuilder.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DefaultConfigurationBuilder.java Fri Feb 15 01:46:09 2008
@@ -14,6 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.commons.configuration2;
 
 import java.io.File;
@@ -324,7 +325,7 @@
     private CombinedConfiguration constructedConfiguration;
 
     /** Stores a map with the registered configuration providers. */
-    private Map providers;
+    private Map<String, ConfigurationProvider> providers;
 
     /** Stores the base path to the configuration sources to load. */
     private String configurationBasePath;
@@ -338,7 +339,7 @@
     public DefaultConfigurationBuilder()
     {
         super();
-        providers = new HashMap();
+        providers = new HashMap<String, ConfigurationProvider>();
         registerDefaultProviders();
         registerBeanFactory();
         setLogger(LogFactory.getLog(getClass()));
@@ -420,8 +421,7 @@
      * @param tagName the name of the tag in the configuration definition file
      * @param provider the provider for this tag
      */
-    public void addConfigurationProvider(String tagName,
-            ConfigurationProvider provider)
+    public void addConfigurationProvider(String tagName, ConfigurationProvider provider)
     {
         if (tagName == null)
         {
@@ -496,18 +496,16 @@
         CombinedConfiguration result = createResultConfiguration();
         constructedConfiguration = result;
 
-        List overrides = fetchTopLevelOverrideConfigs();
+        List<SubnodeConfiguration> overrides = fetchTopLevelOverrideConfigs();
         overrides.addAll(fetchChildConfigs(KEY_OVERRIDE));
         initCombinedConfiguration(result, overrides, KEY_OVERRIDE_LIST);
 
-        List additionals = fetchChildConfigs(KEY_UNION);
+        List<SubnodeConfiguration> additionals = fetchChildConfigs(KEY_UNION);
         if (!additionals.isEmpty())
         {
-            CombinedConfiguration addConfig = new CombinedConfiguration(
-                    new UnionCombiner());
+            CombinedConfiguration addConfig = new CombinedConfiguration(new UnionCombiner());
             result.addConfiguration(addConfig, ADDITIONAL_NAME);
-            initCombinedConfiguration(addConfig, additionals,
-                    KEY_ADDITIONAL_LIST);
+            initCombinedConfiguration(addConfig, additionals, KEY_ADDITIONAL_LIST);
         }
 
         return result;
@@ -552,7 +550,7 @@
      * @throws ConfigurationException if an error occurs
      */
     protected void initCombinedConfiguration(CombinedConfiguration config,
-            List containedConfigs, String keyListNodes) throws ConfigurationException
+            List<? extends HierarchicalConfiguration> containedConfigs, String keyListNodes) throws ConfigurationException
     {
         List listNodes = getList(keyListNodes);
         for (Iterator it = listNodes.iterator(); it.hasNext();)
@@ -560,17 +558,13 @@
             config.getNodeCombiner().addListNode((String) it.next());
         }
 
-        for (Iterator it = containedConfigs.iterator(); it.hasNext();)
+        for (HierarchicalConfiguration conf : containedConfigs)
         {
-            HierarchicalConfiguration conf = (HierarchicalConfiguration) it
-                    .next();
-            ConfigurationDeclaration decl = new ConfigurationDeclaration(this,
-                    conf);
+            ConfigurationDeclaration decl = new ConfigurationDeclaration(this, conf);
             AbstractConfiguration newConf = createConfigurationAt(decl);
             if (newConf != null)
             {
-                config.addConfiguration(newConf, decl.getConfiguration()
-                        .getString(ATTR_NAME), decl.getAt());
+                config.addConfiguration(newConf, decl.getConfiguration().getString(ATTR_NAME), decl.getAt());
             }
         }
     }
@@ -637,10 +631,10 @@
      * @param node the start node
      * @return a list with subnode configurations for the node's children
      */
-    private List fetchChildConfigs(ConfigurationNode node)
+    private List<SubnodeConfiguration> fetchChildConfigs(ConfigurationNode node)
     {
-        List children = node.getChildren();
-        List result = new ArrayList(children.size());
+        List<ConfigurationNode> children = node.getChildren();
+        List<SubnodeConfiguration> result = new ArrayList<SubnodeConfiguration>(children.size());
         for (Iterator it = children.iterator(); it.hasNext();)
         {
             result.add(createSubnodeConfiguration((Node) it.next()));
@@ -655,16 +649,16 @@
      * @param key the key (must define exactly one node)
      * @return a list with subnode configurations for the node's children
      */
-    private List fetchChildConfigs(String key)
+    private List<SubnodeConfiguration> fetchChildConfigs(String key)
     {
-        List nodes = fetchNodeList(key);
-        if (nodes.size() > 0)
+        List<ConfigurationNode> nodes = fetchNodeList(key);
+        if (!nodes.isEmpty())
         {
-            return fetchChildConfigs((ConfigurationNode) nodes.get(0));
+            return fetchChildConfigs(nodes.get(0));
         }
         else
         {
-            return Collections.EMPTY_LIST;
+            return Collections.emptyList();
         }
     }
 
@@ -678,13 +672,13 @@
      * @return a list with subnode configurations for the top level override
      * configurations
      */
-    private List fetchTopLevelOverrideConfigs()
+    private List<SubnodeConfiguration> fetchTopLevelOverrideConfigs()
     {
-        List configs = fetchChildConfigs(getRootNode());
-        for (Iterator it = configs.iterator(); it.hasNext();)
+        List<SubnodeConfiguration> configs = fetchChildConfigs(getRootNode());
+        Iterator<SubnodeConfiguration> it = configs.iterator();
+        while (it.hasNext())
         {
-            String nodeName = ((SubnodeConfiguration) it.next()).getRootNode()
-                    .getName();
+            String nodeName = (it.next()).getRootNode().getName();
             for (int i = 0; i < CONFIG_SECTIONS.length; i++)
             {
                 if (CONFIG_SECTIONS[i].equals(nodeName))
@@ -1251,17 +1245,13 @@
          * @return the new configuration
          * @throws Exception if an error occurs
          */
-        public AbstractConfiguration getEmptyConfiguration(
-                ConfigurationDeclaration decl) throws Exception
+        public AbstractConfiguration getEmptyConfiguration(ConfigurationDeclaration decl) throws Exception
         {
-            XMLConfiguration config = (XMLConfiguration) super
-                    .getEmptyConfiguration(decl);
+            XMLConfiguration config = (XMLConfiguration) super.getEmptyConfiguration(decl);
 
             // copy the registered entities
-            DefaultConfigurationBuilder builder = decl
-                    .getConfigurationBuilder();
-            config.getRegisteredEntities().putAll(
-                    builder.getRegisteredEntities());
+            DefaultConfigurationBuilder builder = decl.getConfigurationBuilder();
+            config.getRegisteredEntities().putAll(builder.getRegisteredEntities());
             return config;
         }
     }
@@ -1274,8 +1264,7 @@
      * XMLPropertiesConfiguration object must be created, otherwise a
      * PropertiesConfiguration object.
      */
-    static class FileExtensionConfigurationProvider extends
-            FileConfigurationProvider
+    static class FileExtensionConfigurationProvider extends FileConfigurationProvider
     {
         /**
          * Stores the class to be created when the file extension matches.

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/HierarchicalConfigurationConverter.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/HierarchicalConfigurationConverter.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/HierarchicalConfigurationConverter.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/HierarchicalConfigurationConverter.java Fri Feb 15 01:46:09 2008
@@ -59,7 +59,7 @@
         {
             ConfigurationKey keyEmpty = new ConfigurationKey();
             ConfigurationKey keyLast = keyEmpty;
-            Set keySet = new HashSet();
+            Set<String> keySet = new HashSet<String>();
 
             for (Iterator it = config.getKeys(); it.hasNext();)
             {
@@ -138,10 +138,10 @@
      */
     protected Iterator reverseIterator(ConfigurationKey key)
     {
-        List list = new ArrayList();
-        for (ConfigurationKey.KeyIterator it = key.iterator(); it.hasNext();)
+        List<String> list = new ArrayList<String>();
+        for (String k : key.iterator())
         {
-            list.add(it.nextKey());
+            list.add(k);
         }
 
         Collections.reverse(list);
@@ -160,7 +160,7 @@
      * @param keySet the set with the processed keys
      * @return the name of the last element on the path
      */
-    protected String openElements(ConfigurationKey keyLast, ConfigurationKey keyAct, Configuration config, Set keySet)
+    protected String openElements(ConfigurationKey keyLast, ConfigurationKey keyAct, Configuration config, Set<String> keySet)
     {
         ConfigurationKey.KeyIterator it = keyLast.differenceKey(keyAct).iterator();
         ConfigurationKey k = keyLast.commonKey(keyAct);

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/INIConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/INIConfiguration.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/INIConfiguration.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/INIConfiguration.java Fri Feb 15 01:46:09 2008
@@ -230,10 +230,8 @@
     public void save(Writer writer) throws ConfigurationException
     {
         PrintWriter out = new PrintWriter(writer);
-        Iterator it = getSections().iterator();
-        while (it.hasNext())
+        for (String section : getSections())
         {
-            String section = (String) it.next();
             out.print("[");
             out.print(section);
             out.print("]");
@@ -247,13 +245,11 @@
                 Object value = subset.getProperty(key);
                 if (value instanceof Collection)
                 {
-                    Iterator values = ((Collection) value).iterator();
-                    while (values.hasNext())
+                    for (Object val : ((Collection) value))
                     {
-                        value = (Object) values.next();
                         out.print(key);
                         out.print(" = ");
-                        out.print(formatValue(value.toString()));
+                        out.print(formatValue(val.toString()));
                         out.println();
                     }
                 }

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/JNDIConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/JNDIConfiguration.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/JNDIConfiguration.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/JNDIConfiguration.java Fri Feb 15 01:46:09 2008
@@ -22,6 +22,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
+import java.util.Arrays;
 
 import javax.naming.Context;
 import javax.naming.InitialContext;
@@ -55,7 +56,7 @@
     private Context baseContext;
 
     /** The Set of keys that have been virtually cleared. */
-    private Set clearedProperties = new HashSet();
+    private Set<String> clearedProperties = new HashSet<String>();
 
     /**
      * Creates a JNDIConfiguration using the default initial context as the
@@ -118,7 +119,7 @@
      * @param processedCtx a set with the so far processed objects
      * @throws NamingException If JNDI has an issue.
      */
-    private void recursiveGetKeys(Set keys, Context context, String prefix, Set processedCtx) throws NamingException
+    private void recursiveGetKeys(Set<String> keys, Context context, String prefix, Set<Context> processedCtx) throws NamingException
     {
         processedCtx.add(context);
         NamingEnumeration elements = null;
@@ -175,7 +176,7 @@
      *
      * @return an iterator with all keys
      */
-    public Iterator getKeys()
+    public Iterator<String> getKeys()
     {
         return getKeys("");
     }
@@ -187,17 +188,10 @@
      * @param prefix the prefix
      * @return an iterator with the selected keys
      */
-    public Iterator getKeys(String prefix)
+    public Iterator<String> getKeys(String prefix)
     {
         // build the path
-        String[] splitPath = StringUtils.split(prefix, ".");
-
-        List path = new ArrayList();
-
-        for (int i = 0; i < splitPath.length; i++)
-        {
-            path.add(splitPath[i]);
-        }
+        List<String> path = Arrays.asList(StringUtils.split(prefix, "."));
 
         try
         {
@@ -205,10 +199,10 @@
             Context context = getContext(path, getBaseContext());
 
             // return all the keys under the context found
-            Set keys = new HashSet();
+            Set<String> keys = new HashSet<String>();
             if (context != null)
             {
-                recursiveGetKeys(keys, context, prefix, new HashSet());
+                recursiveGetKeys(keys, context, prefix, new HashSet<Context>());
             }
             else if (containsKey(prefix))
             {
@@ -221,7 +215,7 @@
         catch (NamingException e)
         {
             fireError(EVENT_READ_PROPERTY, null, null, e);
-            return new ArrayList().iterator();
+            return new ArrayList<String>().iterator();
         }
     }
 

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/MapConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/MapConfiguration.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/MapConfiguration.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/MapConfiguration.java Fri Feb 15 01:46:09 2008
@@ -64,7 +64,7 @@
         Object value = map.get(key);
         if ((value instanceof String) && (!isDelimiterParsingDisabled()))
         {
-            List list = PropertyConverter.split((String) value, getListDelimiter());
+            List<String> list = PropertyConverter.split((String) value, getListDelimiter());
             return list.size() > 1 ? list : list.get(0);
         }
         else
@@ -112,7 +112,7 @@
         map.remove(key);
     }
 
-    public Iterator getKeys()
+    public Iterator<String> getKeys()
     {
         return map.keySet().iterator();
     }

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/PrefixedKeysIterator.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/PrefixedKeysIterator.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/PrefixedKeysIterator.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/PrefixedKeysIterator.java Fri Feb 15 01:46:09 2008
@@ -70,14 +70,7 @@
      */
     public boolean hasNext()
     {
-        if (nextElementSet)
-        {
-            return true;
-        }
-        else
-        {
-            return setNextElement();
-        }
+        return nextElementSet || setNextElement();
     }
 
     /**

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/SubnodeConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/SubnodeConfiguration.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/SubnodeConfiguration.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/SubnodeConfiguration.java Fri Feb 15 01:46:09 2008
@@ -203,7 +203,7 @@
         {
             try
             {
-                List nodes = getParent().fetchNodeList(getSubnodeKey());
+                List<ConfigurationNode> nodes = getParent().fetchNodeList(getSubnodeKey());
                 if (nodes.size() != 1)
                 {
                     // key is invalid, so detach this subnode configuration
@@ -211,12 +211,10 @@
                 }
                 else
                 {
-                    ConfigurationNode currentRoot = (ConfigurationNode) nodes
-                            .get(0);
+                    ConfigurationNode currentRoot = nodes.get(0);
                     if (currentRoot != super.getRootNode())
                     {
-                        // the root node was changed due to a change of the
-                        // parent
+                        // the root node was changed due to a change of the parent
                         setRootNode(currentRoot);
                     }
                     return currentRoot;
@@ -274,7 +272,7 @@
         {
             // construct the correct subnode key
             // determine path to root node
-            List lstPathToRoot = new ArrayList();
+            List<ConfigurationNode> lstPathToRoot = new ArrayList<ConfigurationNode>();
             ConfigurationNode top = super.getRootNode();
             ConfigurationNode nd = node;
             while (nd != top)

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/XMLConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/XMLConfiguration.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/XMLConfiguration.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/XMLConfiguration.java Fri Feb 15 01:46:09 2008
@@ -30,7 +30,6 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
@@ -45,6 +44,7 @@
 import javax.xml.transform.stream.StreamResult;
 
 import org.apache.commons.configuration2.tree.ConfigurationNode;
+
 import org.w3c.dom.Attr;
 import org.w3c.dom.CDATASection;
 import org.w3c.dom.DOMException;
@@ -161,7 +161,7 @@
     private Document document;
 
     /** Stores a map with the registered public IDs.*/
-    private Map registeredEntities = new HashMap();
+    private Map<String, URL> registeredEntities = new HashMap<String, URL>();
 
     /** Stores the name of the root element. */
     private String rootElementName;
@@ -483,15 +483,13 @@
             if (w3cNode instanceof Attr)
             {
                 Attr attr = (Attr) w3cNode;
-                Iterator it = PropertyConverter.split(
-                        attr.getValue(),
-                        isDelimiterParsingDisabled() ? ATTR_VALUE_DELIMITER
-                                : getListDelimiter()).iterator();
-                while (it.hasNext())
+                char delimiter = isDelimiterParsingDisabled() ? ATTR_VALUE_DELIMITER : getListDelimiter();
+                List<String> values = PropertyConverter.split(attr.getValue(), delimiter);
+
+                for (String value : values)
                 {
-                    Node child = new XMLNode(attr.getName(),
-                            elemRefs ? element : null);
-                    child.setValue(it.next());
+                    Node child = new XMLNode(attr.getName(), elemRefs ? element : null);
+                    child.setValue(value);
                     node.addAttribute(child);
                 }
             }
@@ -517,8 +515,7 @@
             }
             else
             {
-                values = PropertyConverter.split(child.getValue().toString(),
-                    getListDelimiter());
+                values = PropertyConverter.split(child.getValue().toString(), getListDelimiter());
             }
 
             if (values.size() > 1)
@@ -528,8 +525,7 @@
                 Node c = createNode(child.getName());
                 c.setValue(it.next());
                 // Copy original attributes to the new node
-                for (Iterator itAttrs = child.getAttributes().iterator(); itAttrs
-                        .hasNext();)
+                for (Iterator itAttrs = child.getAttributes().iterator(); itAttrs.hasNext();)
                 {
                     Node ndAttr = (Node) itAttrs.next();
                     ndAttr.setReference(null);
@@ -800,14 +796,14 @@
      */
     public void addNodes(String key, Collection nodes)
     {
-        Collection xmlNodes;
+        Collection<ConfigurationNode> xmlNodes;
 
         if (nodes != null && !nodes.isEmpty())
         {
-            xmlNodes = new ArrayList(nodes.size());
-            for (Iterator it = nodes.iterator(); it.hasNext();)
+            xmlNodes = new ArrayList<ConfigurationNode>(nodes.size());
+            for (ConfigurationNode node : (Collection<ConfigurationNode>) nodes)
             {
-                xmlNodes.add(convertToXMLNode((ConfigurationNode) it.next()));
+                xmlNodes.add(convertToXMLNode(node));
             }
         }
         else
@@ -836,17 +832,18 @@
             return (XMLNode) node;
         }
 
-        XMLNode nd = (XMLNode) createNode(node.getName());
-        nd.setValue(node.getValue());
-        for (Iterator it = node.getChildren().iterator(); it.hasNext();)
+        XMLNode xmlNode = (XMLNode) createNode(node.getName());
+        xmlNode.setValue(node.getValue());
+        for (ConfigurationNode child : node.getChildren())
         {
-            nd.addChild(convertToXMLNode((ConfigurationNode) it.next()));
+            xmlNode.addChild(convertToXMLNode(child));
         }
-        for (Iterator it = node.getAttributes().iterator(); it.hasNext();)
+
+        for (ConfigurationNode attribute : node.getAttributes())
         {
-            nd.addAttribute(convertToXMLNode((ConfigurationNode) it.next()));
+            xmlNode.addAttribute(convertToXMLNode(attribute));
         }
-        return nd;
+        return xmlNode;
     }
 
     /**
@@ -947,7 +944,7 @@
      *
      * @return a map with the registered entity IDs
      */
-    Map getRegisteredEntities()
+    Map<String, URL> getRegisteredEntities()
     {
         return registeredEntities;
     }
@@ -1086,7 +1083,7 @@
             Element elem = (Element) getReference();
             // Find all Text nodes
             NodeList children = elem.getChildNodes();
-            Collection textNodes = new ArrayList();
+            Collection<org.w3c.dom.Node> textNodes = new ArrayList<org.w3c.dom.Node>();
             for (int i = 0; i < children.getLength(); i++)
             {
                 org.w3c.dom.Node nd = children.item(i);
@@ -1213,22 +1210,20 @@
         {
             if (node != null && elem != null)
             {
-                List attrs = node.getAttributes(name);
+                List<ConfigurationNode> attributes = node.getAttributes(name);
                 StringBuffer buf = new StringBuffer();
                 char delimiter = (listDelimiter != 0) ? listDelimiter : ATTR_VALUE_DELIMITER;
-                for (Iterator it = attrs.iterator(); it.hasNext();)
+                for (ConfigurationNode attribute : attributes)
                 {
-                    Node attr = (Node) it.next();
-                    if (attr.getValue() != null)
+                    if (attribute.getValue() != null)
                     {
                         if (buf.length() > 0)
                         {
                             buf.append(delimiter);
                         }
-                        buf.append(PropertyConverter.escapeDelimiters(attr
-                                .getValue().toString(), delimiter));
+                        buf.append(PropertyConverter.escapeDelimiters(attribute.getValue().toString(), delimiter));
                     }
-                    attr.setReference(elem);
+                    attribute.setReference(elem);
                 }
 
                 if (buf.length() < 1)

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/beanutils/XMLBeanDeclaration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/beanutils/XMLBeanDeclaration.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/beanutils/XMLBeanDeclaration.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/beanutils/XMLBeanDeclaration.java Fri Feb 15 01:46:09 2008
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.commons.configuration2.beanutils;
 
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 
 import org.apache.commons.configuration2.HierarchicalConfiguration;
@@ -282,13 +282,12 @@
      */
     public Map getBeanProperties()
     {
-        Map props = new HashMap();
-        for (Iterator it = getNode().getAttributes().iterator(); it.hasNext();)
+        Map<String, Object> props = new HashMap<String, Object>();
+        for (ConfigurationNode attribute : getNode().getAttributes())
         {
-            ConfigurationNode attr = (ConfigurationNode) it.next();
-            if (!isReservedNode(attr))
+            if (!isReservedNode(attribute))
             {
-                props.put(attr.getName(), interpolate(attr .getValue()));
+                props.put(attribute.getName(), interpolate(attribute.getValue()));
             }
         }
 
@@ -304,14 +303,12 @@
      */
     public Map getNestedBeanDeclarations()
     {
-        Map nested = new HashMap();
-        for (Iterator it = getNode().getChildren().iterator(); it.hasNext();)
+        Map<String, XMLBeanDeclaration> nested = new HashMap<String, XMLBeanDeclaration>();
+        for (ConfigurationNode child : getNode().getChildren())
         {
-            ConfigurationNode child = (ConfigurationNode) it.next();
             if (!isReservedNode(child))
             {
-                nested.put(child.getName(), new XMLBeanDeclaration(
-                        getConfiguration().configurationAt(child.getName()), child));
+                nested.put(child.getName(), new XMLBeanDeclaration(getConfiguration().configurationAt(child.getName()), child));
             }
         }
 

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListConfiguration.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListConfiguration.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListConfiguration.java Fri Feb 15 01:46:09 2008
@@ -36,6 +36,7 @@
 import org.apache.commons.configuration2.ConfigurationException;
 import org.apache.commons.configuration2.HierarchicalConfiguration;
 import org.apache.commons.configuration2.MapConfiguration;
+import org.apache.commons.configuration2.tree.ConfigurationNode;
 import org.apache.commons.lang.StringUtils;
 
 /**
@@ -253,7 +254,7 @@
         }
 
         // get all non trivial nodes
-        List children = new ArrayList(node.getChildren());
+        List<ConfigurationNode> children = new ArrayList<ConfigurationNode>(node.getChildren());
         Iterator it = children.iterator();
         while (it.hasNext())
         {

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/XMLPropertyListConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/XMLPropertyListConfiguration.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/XMLPropertyListConfiguration.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/XMLPropertyListConfiguration.java Fri Feb 15 01:46:09 2008
@@ -41,6 +41,7 @@
 import org.apache.commons.configuration2.ConfigurationException;
 import org.apache.commons.configuration2.HierarchicalConfiguration;
 import org.apache.commons.configuration2.MapConfiguration;
+import org.apache.commons.configuration2.tree.ConfigurationNode;
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.commons.lang.StringUtils;
 
@@ -273,7 +274,7 @@
     /**
      * Append a node to the writer, indented according to a specific level.
      */
-    private void printNode(PrintWriter out, int indentLevel, Node node)
+    private void printNode(PrintWriter out, int indentLevel, ConfigurationNode node)
     {
         String padding = StringUtils.repeat(" ", indentLevel * INDENT_SIZE);
 
@@ -282,15 +283,15 @@
             out.println(padding + "<key>" + StringEscapeUtils.escapeXml(node.getName()) + "</key>");
         }
 
-        List children = node.getChildren();
+        List<ConfigurationNode> children = node.getChildren();
         if (!children.isEmpty())
         {
             out.println(padding + "<dict>");
 
-            Iterator it = children.iterator();
+            Iterator<ConfigurationNode> it = children.iterator();
             while (it.hasNext())
             {
-                Node child = (Node) it.next();
+                ConfigurationNode child = it.next();
                 printNode(out, indentLevel + 1, child);
 
                 if (it.hasNext())
@@ -348,10 +349,9 @@
         else if (value instanceof List)
         {
             out.println(padding + "<array>");
-            Iterator it = ((List) value).iterator();
-            while (it.hasNext())
+            for (Object val : ((List) value))
             {
-                printValue(out, indentLevel + 1, it.next());
+                printValue(out, indentLevel + 1, val);
             }
             out.println(padding + "</array>");
         }
@@ -409,7 +409,7 @@
         private StringBuffer buffer = new StringBuffer();
 
         /** The stack of configuration nodes */
-        private List stack = new ArrayList();
+        private List<Node> stack = new ArrayList<Node>();
 
         public XMLPropertyListHandler(Node root)
         {

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/ConfigurationNode.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/ConfigurationNode.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/ConfigurationNode.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/ConfigurationNode.java Fri Feb 15 01:46:09 2008
@@ -14,6 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.commons.configuration2.tree;
 
 import java.util.List;

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/DefaultConfigurationKey.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/DefaultConfigurationKey.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/DefaultConfigurationKey.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/DefaultConfigurationKey.java Fri Feb 15 01:46:09 2008
@@ -627,11 +627,11 @@
          *
          * @return a clone of this object
          */
-        public Object clone()
+        public KeyIterator clone()
         {
             try
             {
-                return super.clone();
+                return (KeyIterator) super.clone();
             }
             catch (CloneNotSupportedException cex)
             {

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/DefaultConfigurationNode.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/DefaultConfigurationNode.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/DefaultConfigurationNode.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/DefaultConfigurationNode.java Fri Feb 15 01:46:09 2008
@@ -14,6 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.commons.configuration2.tree;
 
 import java.util.ArrayList;
@@ -188,7 +189,7 @@
      *
      * @return a list with all child nodes
      */
-    public List getChildren()
+    public List<ConfigurationNode> getChildren()
     {
         return children.getSubNodes();
     }
@@ -209,7 +210,7 @@
      * @param name the name; can be <b>null </b>, then all children are returned
      * @return a list of all children with the given name
      */
-    public List getChildren(String name)
+    public List<ConfigurationNode> getChildren(String name)
     {
         return children.getSubNodes(name);
     }
@@ -302,12 +303,11 @@
     }
 
     /**
-     * Returns a list with the attributes of this node. This list contains
-     * <code>ConfigurationNode</code> objects, too.
+     * Returns a list with the attributes of this node.
      *
      * @return the attribute list, never <b>null </b>
      */
-    public List getAttributes()
+    public List<ConfigurationNode> getAttributes()
     {
         return attributes.getSubNodes();
     }
@@ -328,7 +328,7 @@
      * @param name the attribute's name
      * @return all attributes with this name
      */
-    public List getAttributes(String name)
+    public List<ConfigurationNode> getAttributes(String name)
     {
         return attributes.getSubNodes(name);
     }
@@ -492,10 +492,10 @@
     protected static class SubNodes
     {
         /** Stores a list for the sub nodes. */
-        private List nodes;
+        private List<ConfigurationNode> nodes;
 
         /** Stores a map for accessing subnodes by name. */
-        private Map namedNodes;
+        private Map<String, List<ConfigurationNode>> namedNodes;
 
         /**
          * Adds a new sub node.
@@ -506,22 +506,21 @@
         {
             if (node == null || node.getName() == null)
             {
-                throw new IllegalArgumentException(
-                        "Node to add must have a defined name!");
+                throw new IllegalArgumentException("Node to add must have a defined name!");
             }
             node.setParentNode(null);  // reset, will later be set
 
             if (nodes == null)
             {
-                nodes = new ArrayList();
-                namedNodes = new HashMap();
+                nodes = new ArrayList<ConfigurationNode>();
+                namedNodes = new HashMap<String, List<ConfigurationNode>>();
             }
 
             nodes.add(node);
-            List lst = (List) namedNodes.get(node.getName());
+            List<ConfigurationNode> lst = namedNodes.get(node.getName());
             if (lst == null)
             {
-                lst = new LinkedList();
+                lst = new LinkedList<ConfigurationNode>();
                 namedNodes.put(node.getName(), lst);
             }
             lst.add(node);
@@ -538,13 +537,13 @@
             if (nodes != null && node != null && nodes.contains(node))
             {
                 detachNode(node);
-                nodes.remove(node);
+                this.nodes.remove(node);
 
-                List lst = (List) namedNodes.get(node.getName());
-                if (lst != null)
+                List<ConfigurationNode> nodes = namedNodes.get(node.getName());
+                if (nodes != null)
                 {
-                    lst.remove(node);
-                    if (lst.isEmpty())
+                    nodes.remove(node);
+                    if (nodes.isEmpty())
                     {
                         namedNodes.remove(node.getName());
                     }
@@ -568,11 +567,11 @@
         {
             if (nodes != null && name != null)
             {
-                List lst = (List) namedNodes.remove(name);
-                if (lst != null)
+                List<ConfigurationNode> nodes = namedNodes.remove(name);
+                if (nodes != null)
                 {
-                    detachNodes(lst);
-                    nodes.removeAll(lst);
+                    detachNodes(nodes);
+                    this.nodes.removeAll(nodes);
                     return true;
                 }
             }
@@ -605,7 +604,7 @@
             {
                 throw new IndexOutOfBoundsException("No sub nodes available!");
             }
-            return (ConfigurationNode) nodes.get(index);
+            return nodes.get(index);
         }
 
         /**
@@ -614,10 +613,16 @@
          *
          * @return a list with the sub nodes
          */
-        public List getSubNodes()
+        public List<ConfigurationNode> getSubNodes()
         {
-            return (nodes == null) ? Collections.EMPTY_LIST : Collections
-                    .unmodifiableList(nodes);
+            if (nodes == null)
+            {
+                return Collections.emptyList();
+            }
+            else
+            {
+                return Collections.unmodifiableList(nodes);
+            }
         }
 
         /**
@@ -628,25 +633,31 @@
          * be returned
          * @return all sub nodes with this name
          */
-        public List getSubNodes(String name)
+        public List<ConfigurationNode> getSubNodes(String name)
         {
             if (name == null)
             {
                 return getSubNodes();
             }
 
-            List result;
+            List<ConfigurationNode> result;
             if (nodes == null)
             {
                 result = null;
             }
             else
             {
-                result = (List) namedNodes.get(name);
+                result = namedNodes.get(name);
             }
 
-            return (result == null) ? Collections.EMPTY_LIST : Collections
-                    .unmodifiableList(result);
+            if (result == null)
+            {
+                return Collections.emptyList();
+            }
+            else
+            {
+                return Collections.unmodifiableList(result);
+            }
         }
 
         /**
@@ -658,10 +669,9 @@
         {
             if (nodes != null)
             {
-                for (Iterator it = nodes.iterator(); it.hasNext()
-                        && !visitor.terminate();)
+                for (Iterator<ConfigurationNode> it = nodes.iterator(); it.hasNext() && !visitor.terminate();)
                 {
-                    ((ConfigurationNode) it.next()).visit(visitor);
+                    it.next().visit(visitor);
                 }
             }
         }
@@ -688,11 +698,11 @@
          *
          * @param subNodes the list with nodes to be detached
          */
-        protected void detachNodes(Collection subNodes)
+        protected void detachNodes(Collection<ConfigurationNode> subNodes)
         {
-            for (Iterator it = subNodes.iterator(); it.hasNext();)
+            for (ConfigurationNode node : subNodes)
             {
-                detachNode((ConfigurationNode) it.next());
+                detachNode(node);
             }
         }
     }

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/DefaultExpressionEngine.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/DefaultExpressionEngine.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/DefaultExpressionEngine.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/DefaultExpressionEngine.java Fri Feb 15 01:46:09 2008
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.commons.configuration2.tree;
 
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 
@@ -280,11 +280,10 @@
      * @param key the key
      * @return a list with the matching nodes
      */
-    public List query(ConfigurationNode root, String key)
+    public List<ConfigurationNode> query(ConfigurationNode root, String key)
     {
-        List nodes = new LinkedList();
-        findNodesForKey(new DefaultConfigurationKey(this, key).iterator(),
-                root, nodes);
+        List<ConfigurationNode> nodes = new LinkedList<ConfigurationNode>();
+        findNodesForKey(new DefaultConfigurationKey(this, key).iterator(), root, nodes);
         return nodes;
     }
 
@@ -449,8 +448,7 @@
      * @param node the actual node
      * @param nodes here the found nodes are stored
      */
-    protected void findNodesForKey(DefaultConfigurationKey.KeyIterator keyPart,
-            ConfigurationNode node, Collection nodes)
+    protected void findNodesForKey(DefaultConfigurationKey.KeyIterator keyPart, ConfigurationNode node, Collection<ConfigurationNode> nodes)
     {
         if (!keyPart.hasNext())
         {
@@ -490,20 +488,16 @@
             if (!keyIt.isPropertyKey())
             {
                 // Attribute keys can only appear as last elements of the path
-                throw new IllegalArgumentException(
-                        "Invalid path for add operation: "
-                                + "Attribute key in the middle!");
+                throw new IllegalArgumentException("Invalid path for add operation: Attribute key in the middle!");
             }
-            int idx = keyIt.hasIndex() ? keyIt.getIndex() : node
-                    .getChildrenCount(keyPart) - 1;
+            int idx = keyIt.hasIndex() ? keyIt.getIndex() : node.getChildrenCount(keyPart) - 1;
             if (idx < 0 || idx >= node.getChildrenCount(keyPart))
             {
                 return node;
             }
             else
             {
-                return findLastPathNode(keyIt, (ConfigurationNode) node
-                        .getChildren(keyPart).get(idx));
+                return findLastPathNode(keyIt, node.getChildren(keyPart).get(idx));
             }
         }
 
@@ -522,24 +516,20 @@
      * @param subNodes a list with the sub nodes to process
      * @param nodes the target collection
      */
-    private void processSubNodes(DefaultConfigurationKey.KeyIterator keyPart,
-            List subNodes, Collection nodes)
+    private void processSubNodes(DefaultConfigurationKey.KeyIterator keyPart, List<ConfigurationNode> subNodes, Collection<ConfigurationNode> nodes)
     {
         if (keyPart.hasIndex())
         {
             if (keyPart.getIndex() >= 0 && keyPart.getIndex() < subNodes.size())
             {
-                findNodesForKey((DefaultConfigurationKey.KeyIterator) keyPart
-                        .clone(), (ConfigurationNode) subNodes.get(keyPart
-                        .getIndex()), nodes);
+                findNodesForKey(keyPart.clone(), subNodes.get(keyPart.getIndex()), nodes);
             }
         }
         else
         {
-            for (Iterator it = subNodes.iterator(); it.hasNext();)
+            for (ConfigurationNode subNode : subNodes)
             {
-                findNodesForKey((DefaultConfigurationKey.KeyIterator) keyPart
-                        .clone(), (ConfigurationNode) it.next(), nodes);
+                findNodesForKey(keyPart.clone(), subNode, nodes);
             }
         }
     }

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/NodeCombiner.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/NodeCombiner.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/NodeCombiner.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/NodeCombiner.java Fri Feb 15 01:46:09 2008
@@ -14,6 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.commons.configuration2.tree;
 
 import java.util.Collections;
@@ -44,23 +45,21 @@
  * can be passed the name of a node, which should be considered a list node.
  * </p>
  *
- * @author <a
- * href="http://commons.apache.org/configuration/team-list.html">Commons
- * Configuration team</a>
+ * @author <a href="http://commons.apache.org/configuration/team-list.html">Commons Configuration team</a>
  * @version $Id$
  * @since 1.3
  */
 public abstract class NodeCombiner
 {
     /** Stores a list with node names that are known to be list nodes. */
-    protected Set listNodes;
+    protected Set<String> listNodes;
 
     /**
      * Creates a new instance of <code>NodeCombiner</code>.
      */
     public NodeCombiner()
     {
-        listNodes = new HashSet();
+        listNodes = new HashSet<String>();
     }
 
     /**
@@ -79,7 +78,7 @@
      *
      * @return a set with the names of list nodes
      */
-    public Set getListNodes()
+    public Set<String> getListNodes()
     {
         return Collections.unmodifiableSet(listNodes);
     }
@@ -106,8 +105,7 @@
      * @param node2 the second root node
      * @return the resulting combined node structure
      */
-    public abstract ConfigurationNode combine(ConfigurationNode node1,
-            ConfigurationNode node2);
+    public abstract ConfigurationNode combine(ConfigurationNode node1, ConfigurationNode node2);
 
     /**
      * Creates a new view node. This method will be called whenever a new view

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/OverrideCombiner.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/OverrideCombiner.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/OverrideCombiner.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/OverrideCombiner.java Fri Feb 15 01:46:09 2008
@@ -14,6 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.commons.configuration2.tree;
 
 import java.util.Iterator;
@@ -63,16 +64,15 @@
      * @param node2 the second node
      * @return the resulting combined node structure
      */
-    public ConfigurationNode combine(ConfigurationNode node1,
-            ConfigurationNode node2)
+    public ConfigurationNode combine(ConfigurationNode node1, ConfigurationNode node2)
     {
         ViewNode result = createViewNode();
         result.setName(node1.getName());
 
         // Process nodes from the first structure, which override the second
-        for (Iterator it = node1.getChildren().iterator(); it.hasNext();)
+        for (Iterator<ConfigurationNode> it = node1.getChildren().iterator(); it.hasNext();)
         {
-            ConfigurationNode child = (ConfigurationNode) it.next();
+            ConfigurationNode child = it.next();
             ConfigurationNode child2 = canCombine(node1, node2, child);
             if (child2 != null)
             {
@@ -86,9 +86,8 @@
 
         // Process nodes from the second structure, which are not contained
         // in the first structure
-        for (Iterator it = node2.getChildren().iterator(); it.hasNext();)
+        for (ConfigurationNode child : node2.getChildren())
         {
-            ConfigurationNode child = (ConfigurationNode) it.next();
             if (node1.getChildrenCount(child.getName()) < 1)
             {
                 result.addChild(child);
@@ -97,8 +96,7 @@
 
         // Handle attributes and value
         addAttributes(result, node1, node2);
-        result.setValue((node1.getValue() != null) ? node1.getValue() : node2
-                .getValue());
+        result.setValue((node1.getValue() != null) ? node1.getValue() : node2.getValue());
 
         return result;
     }
@@ -113,13 +111,11 @@
      * @param node1 the first node
      * @param node2 the second node
      */
-    protected void addAttributes(ViewNode result, ConfigurationNode node1,
-            ConfigurationNode node2)
+    protected void addAttributes(ViewNode result, ConfigurationNode node1, ConfigurationNode node2)
     {
         result.appendAttributes(node1);
-        for (Iterator it = node2.getAttributes().iterator(); it.hasNext();)
+        for (ConfigurationNode attr : node2.getAttributes())
         {
-            ConfigurationNode attr = (ConfigurationNode) it.next();
             if (node1.getAttributeCount(attr.getName()) == 0)
             {
                 result.addAttribute(attr);
@@ -139,15 +135,13 @@
      * @param child the child node (of the first node)
      * @return a child of the second node, with which a combination is possible
      */
-    protected ConfigurationNode canCombine(ConfigurationNode node1,
-            ConfigurationNode node2, ConfigurationNode child)
+    protected ConfigurationNode canCombine(ConfigurationNode node1, ConfigurationNode node2, ConfigurationNode child)
     {
         if (node2.getChildrenCount(child.getName()) == 1
                 && node1.getChildrenCount(child.getName()) == 1
                 && !isListNode(child))
         {
-            return (ConfigurationNode) node2.getChildren(child.getName())
-                    .get(0);
+            return node2.getChildren(child.getName()).get(0);
         }
         else
         {

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/UnionCombiner.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/UnionCombiner.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/UnionCombiner.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/UnionCombiner.java Fri Feb 15 01:46:09 2008
@@ -16,7 +16,6 @@
  */
 package org.apache.commons.configuration2.tree;
 
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 
@@ -125,8 +124,7 @@
      * @param node2 the second source node
      * @return the union node
      */
-    public ConfigurationNode combine(ConfigurationNode node1,
-            ConfigurationNode node2)
+    public ConfigurationNode combine(ConfigurationNode node1, ConfigurationNode node2)
     {
         ViewNode result = createViewNode();
         result.setName(node1.getName());
@@ -134,12 +132,10 @@
         result.appendAttributes(node2);
 
         // Check if nodes can be combined
-        List children2 = new LinkedList(node2.getChildren());
-        for (Iterator it = node1.getChildren().iterator(); it.hasNext();)
+        List<ConfigurationNode> children2 = new LinkedList<ConfigurationNode>(node2.getChildren());
+        for (ConfigurationNode child1 : node1.getChildren())
         {
-            ConfigurationNode child1 = (ConfigurationNode) it.next();
-            ConfigurationNode child2 = findCombineNode(node1, node2, child1,
-                    children2);
+            ConfigurationNode child2 = findCombineNode(node1, node2, child1, children2);
             if (child2 != null)
             {
                 result.addChild(combine(child1, child2));
@@ -152,9 +148,9 @@
         }
 
         // Add remaining children of node 2
-        for (Iterator it = children2.iterator(); it.hasNext();)
+        for (ConfigurationNode child : children2)
         {
-            result.addChild((ConfigurationNode) it.next());
+            result.addChild(child);
         }
 
         return result;
@@ -193,15 +189,13 @@
      * @return the matching child node of the second source node or <b>null</b>
      * if there is none
      */
-    protected ConfigurationNode findCombineNode(ConfigurationNode node1,
-            ConfigurationNode node2, ConfigurationNode child, List children)
+    protected ConfigurationNode findCombineNode(ConfigurationNode node1, ConfigurationNode node2, ConfigurationNode child, List children)
     {
         if (child.getValue() == null && !isListNode(child)
                 && node1.getChildrenCount(child.getName()) == 1
                 && node2.getChildrenCount(child.getName()) == 1)
         {
-            ConfigurationNode child2 = (ConfigurationNode) node2.getChildren(
-                    child.getName()).iterator().next();
+            ConfigurationNode child2 = node2.getChildren(child.getName()).iterator().next();
             if (child2.getValue() == null)
             {
                 return child2;

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/ViewNode.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/ViewNode.java?rev=627984&r1=627983&r2=627984&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/ViewNode.java (original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/tree/ViewNode.java Fri Feb 15 01:46:09 2008
@@ -14,9 +14,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.configuration2.tree;
 
-import java.util.Iterator;
+package org.apache.commons.configuration2.tree;
 
 /**
  * <p>
@@ -32,9 +31,7 @@
  * configuration.
  * </p>
  *
- * @author <a
- * href="http://commons.apache.org/configuration/team-list.html">Commons
- * Configuration team</a>
+ * @author <a href="http://commons.apache.org/configuration/team-list.html">Commons Configuration team</a>
  * @version $Id$
  * @since 1.3
  */
@@ -93,9 +90,9 @@
     {
         if (source != null)
         {
-            for (Iterator it = source.getAttributes().iterator(); it.hasNext();)
+            for (ConfigurationNode attribute : source.getAttributes())
             {
-                addAttribute((ConfigurationNode) it.next());
+                addAttribute(attribute);
             }
         }
     }
@@ -109,9 +106,9 @@
     {
         if (source != null)
         {
-            for (Iterator it = source.getChildren().iterator(); it.hasNext();)
+            for (ConfigurationNode child : source.getChildren())
             {
-                addChild((ConfigurationNode) it.next());
+                addChild(child);
             }
         }
     }



Mime
View raw message