Utils.dupString should allow 0 number of duplicates to produce empty string

This commit is contained in:
Mark DePristo 2013-04-23 18:28:41 -04:00
parent f5a301fb63
commit 0587a145bf
1 changed files with 1 additions and 1 deletions

View File

@ -294,7 +294,7 @@ public class Utils {
*/
public static String dupString(final String s, int nCopies) {
if ( s == null || s.equals("") ) throw new IllegalArgumentException("Bad s " + s);
if ( nCopies < 1 ) throw new IllegalArgumentException("nCopies must be >= 1 but got " + nCopies);
if ( nCopies < 0 ) throw new IllegalArgumentException("nCopies must be >= 0 but got " + nCopies);
final StringBuilder b = new StringBuilder();
for ( int i = 0; i < nCopies; i++ )