You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by az...@apache.org on 2008/10/03 12:27:48 UTC

svn commit: r701346 - /webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/ContextClusteringCommandFactory.java

Author: azeez
Date: Fri Oct  3 03:27:46 2008
New Revision: 701346

URL: http://svn.apache.org/viewvc?rev=701346&view=rev
Log:
Using Java5 syntax/generics

Modified:
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/ContextClusteringCommandFactory.java

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/ContextClusteringCommandFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/ContextClusteringCommandFactory.java?rev=701346&r1=701345&r2=701346&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/ContextClusteringCommandFactory.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/clustering/context/ContextClusteringCommandFactory.java Fri Oct  3 03:27:46 2008
@@ -52,11 +52,11 @@
     getCommandCollection(AbstractContext[] contexts,
                          Map excludedReplicationPatterns) {
 
-        ArrayList commands = new ArrayList(contexts.length);
+        ArrayList<ContextClusteringCommand> commands = new ArrayList<ContextClusteringCommand>(contexts.length);
         ContextClusteringCommandCollection collection =
                 new ContextClusteringCommandCollection(commands);
-        for (int i = 0; i < contexts.length; i++) {
-            ContextClusteringCommand cmd = getUpdateCommand(contexts[i],
+        for (AbstractContext context : contexts) {
+            ContextClusteringCommand cmd = getUpdateCommand(context,
                                                             excludedReplicationPatterns,
                                                             false);
             if (cmd != null) {
@@ -150,8 +150,8 @@
         if (!includeAllProperties) {
             synchronized (context) {
                 Map diffs = context.getPropertyDifferences();
-                for (Iterator iter = diffs.keySet().iterator(); iter.hasNext();) {
-                    String key = (String) iter.next();
+                for (Object o : diffs.keySet()) {
+                    String key = (String) o;
                     PropertyDifference diff = (PropertyDifference) diffs.get(key);
                     Object value = diff.getValue();
 
@@ -195,8 +195,7 @@
                                        String[] propertyNames) throws ClusteringFault {
         synchronized (context) {
             Map diffs = context.getPropertyDifferences();
-            for (int i = 0; i < propertyNames.length; i++) {
-                String key = propertyNames[i];
+            for (String key : propertyNames) {
                 Object prop = context.getPropertyNonReplicable(key);
 
                 // First check whether it is serializable
@@ -242,8 +241,8 @@
     }
 
     private static boolean isExcluded(List list, String propertyName) {
-        for (Iterator iter = list.iterator(); iter.hasNext();) {
-            String pattern = (String) iter.next();
+        for (Object aList : list) {
+            String pattern = (String) aList;
             if (pattern.startsWith("*")) {
                 pattern = pattern.replaceAll("\\*", "");
                 if (propertyName.endsWith(pattern)) {