commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r956305 - in /commons/proper/collections/trunk/src: java/org/apache/commons/collections/ java/org/apache/commons/collections/bag/ java/org/apache/commons/collections/bidimap/ java/org/apache/commons/collections/buffer/ java/org/apache/commo...
Date Sat, 19 Jun 2010 22:41:57 GMT
Author: bayard
Date: Sat Jun 19 22:41:56 2010
New Revision: 956305

URL: http://svn.apache.org/viewvc?rev=956305&view=rev
Log:
Moving from StringBuffer API to StringBuilder

Modified:
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/ExtendedProperties.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/AbstractMapBag.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/bidimap/TreeBidiMap.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/buffer/PriorityBuffer.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/keyvalue/AbstractKeyValue.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/list/AbstractLinkedList.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractHashedMap.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/Flat3Map.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/ListOrderedMap.java
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/SingletonMap.java
    commons/proper/collections/trunk/src/test/org/apache/commons/collections/AbstractTestObject.java
    commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestClosureUtils.java
    commons/proper/collections/trunk/src/test/org/apache/commons/collections/buffer/TestPriorityBuffer.java
    commons/proper/collections/trunk/src/test/org/apache/commons/collections/comparators/AbstractTestComparator.java
    commons/proper/collections/trunk/src/test/org/apache/commons/collections/comparators/TestComparatorChain.java
    commons/proper/collections/trunk/src/test/org/apache/commons/collections/iterators/TestFilterListIterator.java

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/ExtendedProperties.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/ExtendedProperties.java?rev=956305&r1=956304&r2=956305&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/ExtendedProperties.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/ExtendedProperties.java
Sat Jun 19 22:41:56 2010
@@ -238,7 +238,7 @@ public class ExtendedProperties extends 
         int end = -1;
         int prec = 0 - END_TOKEN.length();
         String variable = null;
-        StringBuffer result = new StringBuffer();
+        StringBuilder result = new StringBuilder();
 
         // FIXME: we should probably allow the escaping of the start token
         while (((begin = base.indexOf(START_TOKEN, prec + END_TOKEN.length())) > -1)
@@ -250,7 +250,7 @@ public class ExtendedProperties extends 
             if (priorVariables.contains(variable)) {
                 String initialBase = priorVariables.remove(0).toString();
                 priorVariables.add(variable);
-                StringBuffer priorVariableSb = new StringBuffer();
+                StringBuilder priorVariableSb = new StringBuilder();
 
                 // create a nice trace of interpolated variables like so:
                 // var1->var2->var3
@@ -296,7 +296,7 @@ public class ExtendedProperties extends 
      * Inserts a backslash before every comma and backslash. 
      */
     private static String escape(String s) {
-        StringBuffer buf = new StringBuffer(s);
+        StringBuilder buf = new StringBuilder(s);
         for (int i = 0; i < buf.length(); i++) {
             char c = buf.charAt(i);
             if (c == ',' || c == '\\') {
@@ -311,7 +311,7 @@ public class ExtendedProperties extends 
      * Removes a backslash from every pair of backslashes. 
      */
     private static String unescape(String s) {
-        StringBuffer buf = new StringBuffer(s);
+        StringBuilder buf = new StringBuilder(s);
         for (int i = 0; i < buf.length() - 1; i++) {
             char c1 = buf.charAt(i);
             char c2 = buf.charAt(i + 1);
@@ -369,7 +369,7 @@ public class ExtendedProperties extends 
          * @throws IOException if there is difficulty reading the source.
          */
         public String readProperty() throws IOException {
-            StringBuffer buffer = new StringBuffer();
+            StringBuilder buffer = new StringBuilder();
             String line = readLine();
             while (line != null) {
                 line = line.trim();
@@ -423,7 +423,7 @@ public class ExtendedProperties extends 
          * @return A String.
          */
         public String nextToken() {
-            StringBuffer buffer = new StringBuffer();
+            StringBuilder buffer = new StringBuilder();
 
             while (hasMoreTokens()) {
                 String token = super.nextToken();
@@ -757,7 +757,7 @@ public class ExtendedProperties extends 
             Object value = get(key);
             if (value != null) {
                 if (value instanceof String) {
-                    StringBuffer currentOutput = new StringBuffer();
+                    StringBuilder currentOutput = new StringBuilder();
                     currentOutput.append(key);
                     currentOutput.append("=");
                     currentOutput.append(escape((String) value));
@@ -767,7 +767,7 @@ public class ExtendedProperties extends 
                     List values = (List) value;
                     for (Iterator it = values.iterator(); it.hasNext(); ) {
                         String currentElement = (String) it.next();
-                        StringBuffer currentOutput = new StringBuffer();
+                        StringBuilder currentOutput = new StringBuilder();
                         currentOutput.append(key);
                         currentOutput.append("=");
                         currentOutput.append(escape(currentElement));

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/AbstractMapBag.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/AbstractMapBag.java?rev=956305&r1=956304&r2=956305&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/AbstractMapBag.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/bag/AbstractMapBag.java
Sat Jun 19 22:41:56 2010
@@ -579,7 +579,7 @@ public abstract class AbstractMapBag<E> 
         if (size() == 0) {
             return "[]";
         }
-        StringBuffer buf = new StringBuffer();
+        StringBuilder buf = new StringBuilder();
         buf.append('[');
         Iterator<E> it = uniqueSet().iterator();
         while (it.hasNext()) {

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/bidimap/TreeBidiMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/bidimap/TreeBidiMap.java?rev=956305&r1=956304&r2=956305&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/bidimap/TreeBidiMap.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/bidimap/TreeBidiMap.java
Sat Jun 19 22:41:56 2010
@@ -1372,7 +1372,7 @@ public class TreeBidiMap<K extends Compa
         if (nodeCount == 0) {
             return "{}";
         }
-        StringBuffer buf = new StringBuffer(nodeCount * 32);
+        StringBuilder buf = new StringBuilder(nodeCount * 32);
         buf.append('{');
         MapIterator<?, ?> it = getMapIterator(dataElement);
         boolean hasNext = it.hasNext();

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/buffer/PriorityBuffer.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/buffer/PriorityBuffer.java?rev=956305&r1=956304&r2=956305&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/buffer/PriorityBuffer.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/buffer/PriorityBuffer.java
Sat Jun 19 22:41:56 2010
@@ -527,7 +527,7 @@ public class PriorityBuffer<E> extends A
      * @return a string representation of this heap
      */
     public String toString() {
-        final StringBuffer sb = new StringBuffer();
+        final StringBuilder sb = new StringBuilder();
 
         sb.append("[ ");
 

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/keyvalue/AbstractKeyValue.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/keyvalue/AbstractKeyValue.java?rev=956305&r1=956304&r2=956305&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/keyvalue/AbstractKeyValue.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/keyvalue/AbstractKeyValue.java
Sat Jun 19 22:41:56 2010
@@ -73,7 +73,7 @@ public abstract class AbstractKeyValue<K
      * @return a String view of the entry
      */
     public String toString() {
-        return new StringBuffer()
+        return new StringBuilder()
             .append(getKey())
             .append('=')
             .append(getValue())

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/list/AbstractLinkedList.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/list/AbstractLinkedList.java?rev=956305&r1=956304&r2=956305&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/list/AbstractLinkedList.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/list/AbstractLinkedList.java
Sat Jun 19 22:41:56 2010
@@ -360,7 +360,7 @@ public abstract class AbstractLinkedList
         if (size() == 0) {
             return "[]";
         }
-        StringBuffer buf = new StringBuffer(16 * size());
+        StringBuilder buf = new StringBuilder(16 * size());
         buf.append("[");
 
         Iterator<E> it = iterator();

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractHashedMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractHashedMap.java?rev=956305&r1=956304&r2=956305&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractHashedMap.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/AbstractHashedMap.java
Sat Jun 19 22:41:56 2010
@@ -1095,7 +1095,7 @@ public class AbstractHashedMap<K, V> ext
         }
 
         public String toString() {
-            return new StringBuffer().append(getKey()).append('=').append(getValue()).toString();
+            return new StringBuilder().append(getKey()).append('=').append(getValue()).toString();
         }
     }
 
@@ -1331,7 +1331,7 @@ public class AbstractHashedMap<K, V> ext
         if (size() == 0) {
             return "{}";
         }
-        StringBuffer buf = new StringBuffer(32 * size());
+        StringBuilder buf = new StringBuilder(32 * size());
         buf.append('{');
 
         MapIterator<K, V> it = mapIterator();

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/Flat3Map.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/Flat3Map.java?rev=956305&r1=956304&r2=956305&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/Flat3Map.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/Flat3Map.java
Sat Jun 19 22:41:56 2010
@@ -1128,7 +1128,7 @@ public class Flat3Map<K, V> implements I
         if (size == 0) {
             return "{}";
         }
-        StringBuffer buf = new StringBuffer(128);
+        StringBuilder buf = new StringBuilder(128);
         buf.append('{');
         switch (size) {  // drop through
             case 3:

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/ListOrderedMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/ListOrderedMap.java?rev=956305&r1=956304&r2=956305&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/ListOrderedMap.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/ListOrderedMap.java
Sat Jun 19 22:41:56 2010
@@ -321,7 +321,7 @@ public class ListOrderedMap<K, V>
         if (isEmpty()) {
             return "{}";
         }
-        StringBuffer buf = new StringBuffer();
+        StringBuilder buf = new StringBuilder();
         buf.append('{');
         boolean first = true;
         for (Map.Entry<K, V> entry : entrySet()) {

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/SingletonMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/SingletonMap.java?rev=956305&r1=956304&r2=956305&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/SingletonMap.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/SingletonMap.java
Sat Jun 19 22:41:56 2010
@@ -557,7 +557,7 @@ public class SingletonMap<K, V>
      * @return a string version of the map
      */
     public String toString() {
-        return new StringBuffer(128)
+        return new StringBuilder(128)
             .append('{')
             .append((getKey() == this ? "(this Map)" : getKey()))
             .append('=')

Modified: commons/proper/collections/trunk/src/test/org/apache/commons/collections/AbstractTestObject.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/AbstractTestObject.java?rev=956305&r1=956304&r2=956305&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/org/apache/commons/collections/AbstractTestObject.java
(original)
+++ commons/proper/collections/trunk/src/test/org/apache/commons/collections/AbstractTestObject.java
Sat Jun 19 22:41:56 2010
@@ -232,7 +232,7 @@ public abstract class AbstractTestObject
     }
 
     protected String getCanonicalEmptyCollectionName(Object object) {
-        StringBuffer retval = new StringBuffer();
+        StringBuilder retval = new StringBuilder();
         retval.append("data/test/");
         String colName = object.getClass().getName();
         colName = colName.substring(colName.lastIndexOf(".") + 1, colName.length());
@@ -244,7 +244,7 @@ public abstract class AbstractTestObject
     }
 
     protected String getCanonicalFullCollectionName(Object object) {
-        StringBuffer retval = new StringBuffer();
+        StringBuilder retval = new StringBuilder();
         retval.append("data/test/");
         String colName = object.getClass().getName();
         colName = colName.substring(colName.lastIndexOf(".") + 1, colName.length());

Modified: commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestClosureUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestClosureUtils.java?rev=956305&r1=956304&r2=956305&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestClosureUtils.java
(original)
+++ commons/proper/collections/trunk/src/test/org/apache/commons/collections/TestClosureUtils.java
Sat Jun 19 22:41:56 2010
@@ -121,7 +121,7 @@ public class TestClosureUtils extends ju
     //------------------------------------------------------------------
 
     public void testNopClosure() {
-        StringBuffer buf = new StringBuffer("Hello");
+        StringBuilder buf = new StringBuilder("Hello");
         ClosureUtils.nopClosure().execute(null);
         assertEquals("Hello", buf.toString());
         ClosureUtils.nopClosure().execute("Hello");
@@ -132,10 +132,10 @@ public class TestClosureUtils extends ju
     //------------------------------------------------------------------
 
     public void testInvokeClosure() {
-        StringBuffer buf = new StringBuffer("Hello");
+        StringBuilder buf = new StringBuilder("Hello");
         ClosureUtils.invokerClosure("reverse").execute(buf);
         assertEquals("olleH", buf.toString());
-        buf = new StringBuffer("Hello");
+        buf = new StringBuilder("Hello");
         ClosureUtils.invokerClosure("setLength", new Class[] {Integer.TYPE}, new Object[]
{new Integer(2)}).execute(buf);
         assertEquals("He", buf.toString());
     }

Modified: commons/proper/collections/trunk/src/test/org/apache/commons/collections/buffer/TestPriorityBuffer.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/buffer/TestPriorityBuffer.java?rev=956305&r1=956304&r2=956305&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/org/apache/commons/collections/buffer/TestPriorityBuffer.java
(original)
+++ commons/proper/collections/trunk/src/test/org/apache/commons/collections/buffer/TestPriorityBuffer.java
Sat Jun 19 22:41:56 2010
@@ -332,7 +332,7 @@ public class TestPriorityBuffer<E> exten
      */
     protected String showTree(PriorityBuffer<?> h) {
         int count = 1;
-        StringBuffer buffer = new StringBuffer();
+        StringBuilder buffer = new StringBuilder();
         for (int offset = 1; count < h.size() + 1; offset *= 2) {
             for (int i = offset; i < offset * 2; i++) {
                 if (i < h.elements.length && h.elements[i] != null)

Modified: commons/proper/collections/trunk/src/test/org/apache/commons/collections/comparators/AbstractTestComparator.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/comparators/AbstractTestComparator.java?rev=956305&r1=956304&r2=956305&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/org/apache/commons/collections/comparators/AbstractTestComparator.java
(original)
+++ commons/proper/collections/trunk/src/test/org/apache/commons/collections/comparators/AbstractTestComparator.java
Sat Jun 19 22:41:56 2010
@@ -169,7 +169,7 @@ public abstract class AbstractTestCompar
     }
 
     public String getCanonicalComparatorName(Object object) {
-        StringBuffer retval = new StringBuffer();
+        StringBuilder retval = new StringBuilder();
         retval.append("data/test/");
         String colName = object.getClass().getName();
         colName = colName.substring(colName.lastIndexOf(".")+1,colName.length());

Modified: commons/proper/collections/trunk/src/test/org/apache/commons/collections/comparators/TestComparatorChain.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/comparators/TestComparatorChain.java?rev=956305&r1=956304&r2=956305&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/org/apache/commons/collections/comparators/TestComparatorChain.java
(original)
+++ commons/proper/collections/trunk/src/test/org/apache/commons/collections/comparators/TestComparatorChain.java
Sat Jun 19 22:41:56 2010
@@ -144,7 +144,7 @@ public class TestComparatorChain extends
         }
 
         public String toString() {
-            StringBuffer buf = new StringBuffer();
+            StringBuilder buf = new StringBuilder();
             buf.append("[");
             buf.append(cols[0]);
             buf.append(",");

Modified: commons/proper/collections/trunk/src/test/org/apache/commons/collections/iterators/TestFilterListIterator.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/org/apache/commons/collections/iterators/TestFilterListIterator.java?rev=956305&r1=956304&r2=956305&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/org/apache/commons/collections/iterators/TestFilterListIterator.java
(original)
+++ commons/proper/collections/trunk/src/test/org/apache/commons/collections/iterators/TestFilterListIterator.java
Sat Jun 19 22:41:56 2010
@@ -397,7 +397,7 @@ public class TestFilterListIterator exte
         }
 
         // random walk
-        StringBuffer walkdescr = new StringBuffer(500);
+        StringBuilder walkdescr = new StringBuilder(500);
         for (int i = 0; i < 500; i++) {
             if (random.nextBoolean()) {
                 // step forward



Mime
View raw message