<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Times New Roman; font-size: 12pt; color: #000000'>I believe your comments below are not entirely accurate.&nbsp; There is both a performance and footprint benefit to having such a constant, albeit small in either case.&nbsp; Java ensures a single entry for an empty string exists in a class's literal pool within the bytecode, but I don't know of any other internalization or special handling for this.&nbsp; Each class that uses the empty string would have its own bytecode to represent the literal empty string.&nbsp; The constant avoids both this and the instantiation of said string whenever the class itself is instantiated.<br><br>I'd also argue that the EMPTY_STRING constant is more readable, although longer to type, than "".&nbsp; :-P<br><br>John Verhaeg<br>Red Hat, Inc.<br>(314) 336-2950<br><br>----- dna-commits@lists.jboss.org wrote:
<br>| Author: rhauch<br>| Date: 2008-10-28 15:21:10 -0400 (Tue, 28 Oct 2008)<br>| New Revision: 594<br>| <br>| Modified:<br>| &nbsp;&nbsp; trunk/dna-common/src/main/java/org/jboss/dna/common/monitor/SimpleProgressMonitor.java<br>| &nbsp;&nbsp; trunk/dna-common/src/main/java/org/jboss/dna/common/util/StringUtil.java<br>| Log:<br>| Removed the static constant for an empty string, as Java always interns all string literals such as "". &nbsp;So, there is no performance or efficiency benefit, and its simpler (if not shorter) to use "" rather than a constant.<br>| <br>| <br>| Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/monitor/SimpleProgressMonitor.java<br>| ===================================================================<br>| --- trunk/dna-common/src/main/java/org/jboss/dna/common/monitor/SimpleProgressMonitor.java&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2008-10-28 17:55:47 UTC (rev 593)<br>| +++ trunk/dna-common/src/main/java/org/jboss/dna/common/monitor/SimpleProgressMonitor.java&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2008-10-28 19:21:10 UTC (rev 594)<br>| @@ -32,7 +32,6 @@<br>| &nbsp;import org.jboss.dna.common.collection.ThreadSafeProblems;<br>| &nbsp;import org.jboss.dna.common.i18n.I18n;<br>| &nbsp;import org.jboss.dna.common.util.CheckArg;<br>| -import org.jboss.dna.common.util.StringUtil;<br>| &nbsp;<br>| &nbsp;/**<br>| &nbsp;&nbsp;* A basic progress monitor.<br>| @@ -64,8 +63,8 @@<br>| &nbsp;<br>| &nbsp;&nbsp; &nbsp; public SimpleProgressMonitor( String activityName,<br>| &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ProgressMonitor parentProgressMonitor ) {<br>| - &nbsp; &nbsp; &nbsp; &nbsp;this.activityName = activityName == null ? StringUtil.EMPTY_STRING : activityName.trim();<br>| - &nbsp; &nbsp; &nbsp; &nbsp;this.parentActivityName = parentProgressMonitor == null ? StringUtil.EMPTY_STRING : parentProgressMonitor.getActivityName();<br>| + &nbsp; &nbsp; &nbsp; &nbsp;this.activityName = activityName == null ? "" : activityName.trim();<br>| + &nbsp; &nbsp; &nbsp; &nbsp;this.parentActivityName = parentProgressMonitor == null ? "" : parentProgressMonitor.getActivityName();<br>| &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; this.taskName = null;<br>| &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; this.taskNameParams = null;<br>| &nbsp;&nbsp; &nbsp; }<br>| <br>| Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/util/StringUtil.java<br>| ===================================================================<br>| --- trunk/dna-common/src/main/java/org/jboss/dna/common/util/StringUtil.java&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2008-10-28 17:55:47 UTC (rev 593)<br>| +++ trunk/dna-common/src/main/java/org/jboss/dna/common/util/StringUtil.java&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2008-10-28 19:21:10 UTC (rev 594)<br>| @@ -45,7 +45,6 @@<br>| &nbsp;&nbsp;*/<br>| &nbsp;public class StringUtil {<br>| &nbsp;<br>| - &nbsp; &nbsp;public static final String EMPTY_STRING = "";<br>| &nbsp;&nbsp; &nbsp; public static final String[] EMPTY_STRING_ARRAY = new String[0];<br>| &nbsp;&nbsp; &nbsp; private static final Pattern NORMALIZE_PATTERN = Pattern.compile("\\s+");<br>| &nbsp;&nbsp; &nbsp; private static final Pattern PARAMETER_COUNT_PATTERN = Pattern.compile("\\{(\\d+)\\}");<br>| <br>| _______________________________________________<br>| dna-commits mailing list<br>| dna-commits@lists.jboss.org<br>| https://lists.jboss.org/mailman/listinfo/dna-commits<br>| </div></body></html>