Permalink
Browse files

FizzStringReturner may not have copied all characters

I noticed that the String construtor was being called without specifying
the start offset and count. This is unacceptable. How do I know if it's
copying all the characters unless I can actually see it in the code. In
this change, you'll get the distinct air of superiority as you have now
begun dealing with low-level constructs such as arrays. As they say, rub
on some arrays, and watch the women flock.
  • Loading branch information...
Tim Kellogg
Tim Kellogg committed Feb 3, 2017
1 parent 4590711 commit 16d9d00d737a79f68564055440bfe9f949c38f9a
@@ -11,7 +11,8 @@ public String getReturnString() {
final StringBuilder myStringBuilder = new StringBuilder(
com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.Constants.FIZZ);
final String myString = myStringBuilder.toString();
return new String(myString);
final char[] myCharacters = myString.toCharArray();
return new String(myCharacters, 0, myCharacters.length);
}
}

0 comments on commit 16d9d00

Please sign in to comment.