Java arrays can’t have its length changed once created.
What expand() and other similar functions do is create another array w/ a diff. length, copy the contents of the original array to the new 1, and then return the new 1.
So we do need to store the newly returned array to some variable.
That’s why an ArrayList, or in your particular case a StringList, is a much better choice as a dynamic length container: