Skip to content

Instantly share code, notes, and snippets.

@ebuildy
Created November 2, 2018 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ebuildy/e91ac6af2ff8a6b1821d18abf2f8c9e1 to your computer and use it in GitHub Desktop.
Save ebuildy/e91ac6af2ff8a6b1821d18abf2f8c9e1 to your computer and use it in GitHub Desktop.
public void setLength(int newLength) {
if (newLength < 0)
throw new StringIndexOutOfBoundsException(newLength);
ensureCapacityInternal(newLength);
if (count < newLength) {
Arrays.fill(value, count, newLength, '\0');
}
count = newLength;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment