pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1652519 - in /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading: CubicBezierCurve.java Vertex.java
Date Fri, 16 Jan 2015 20:16:08 GMT
Author: tilman
Date: Fri Jan 16 20:16:08 2015
New Revision: 1652519

URL: http://svn.apache.org/r1652519
Log:
PDFBOX-2576: use StringBuilder in loops

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/CubicBezierCurve.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Vertex.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/CubicBezierCurve.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/CubicBezierCurve.java?rev=1652519&r1=1652518&r2=1652519&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/CubicBezierCurve.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/CubicBezierCurve.java
Fri Jan 16 20:16:08 2015
@@ -94,15 +94,15 @@ class CubicBezierCurve
     @Override
     public String toString()
     {
-        String pointStr = "";
+        StringBuilder sb = new StringBuilder();
         for (Point2D p : controlPoints)
         {
-            if (!pointStr.isEmpty())
+            if (sb.length() > 0)
             {
-                pointStr += " ";
+                sb.append(' ');
             }
-            pointStr += p;
+            sb.append(p);
         }
-        return "Cubic Bezier curve{control points p0, p1, p2, p3: " + pointStr + "}";
+        return "Cubic Bezier curve{control points p0, p1, p2, p3: " + sb + "}";
     }
 }

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Vertex.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Vertex.java?rev=1652519&r1=1652518&r2=1652519&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Vertex.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/shading/Vertex.java
Fri Jan 16 20:16:08 2015
@@ -37,15 +37,15 @@ class Vertex
     @Override
     public String toString()
     {
-        String colorStr = "";
+        StringBuilder sb = new StringBuilder();
         for (float f : color)
         {
-            if (!colorStr.isEmpty())
+            if (sb.length() > 0)
             {
-                colorStr += " ";
+                sb.append(' ');
             }
-            colorStr += String.format("%3.2f", f);
+            sb.append(String.format("%3.2f", f));
         }
-        return "Vertex{" + " " + point + ", colors=[" + colorStr + "] }";
+        return "Vertex{ " + point + ", colors=[" + sb + "] }";
     }
 }



Mime
View raw message