ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterrei...@apache.org
Subject svn commit: r581588 - /ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/types/resources/Union.java
Date Wed, 03 Oct 2007 12:50:09 GMT
Author: peterreilly
Date: Wed Oct  3 05:50:09 2007
New Revision: 581588

URL: http://svn.apache.org/viewvc?rev=581588&view=rev
Log:
sync: checkstyle

Modified:
    ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/types/resources/Union.java

Modified: ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/types/resources/Union.java
URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/types/resources/Union.java?rev=581588&r1=581587&r2=581588&view=diff
==============================================================================
--- ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/types/resources/Union.java
(original)
+++ ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/types/resources/Union.java
Wed Oct  3 05:50:09 2007
@@ -104,14 +104,15 @@
         //preserve order-encountered using a list; enforce set logic manually:
         // (LinkedHashSet better, but JDK 1.4+)
         ArrayList union = new ArrayList(rc.size() * 2);
-        Set _union = new HashSet(rc.size() * 2);
+        // Use a set as list.contains() can be expensive for lots of resources
+        Set set = new HashSet(rc.size() * 2);
         for (Iterator rcIter = rc.iterator(); rcIter.hasNext();) {
             for (Iterator r = nextRC(rcIter).iterator(); r.hasNext();) {
                 Object o = r.next();
                 if (asString) {
                     o = o.toString();
                 }
-                if (_union.add(o)) {
+                if (set.add(o)) {
                     union.add(o);
                 }
             }



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


Mime
View raw message