Utils.dupString should allow 0 number of duplicates to produce empty string
This commit is contained in:
parent
f5a301fb63
commit
0587a145bf
|
|
@ -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++ )
|
||||
|
|
|
|||
Loading…
Reference in New Issue