If I don’t know the size of array of chars I’m using, is there a way to use it without setting the size upfront ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In general, you can use a
java.util.Listwhen you don’t know the size up front.Depending on your needs, a
StringBuildermight make more sense than aList<Character>.If you want to get really slick, use Trove for its list-of-primitives so you can work with the (third-party equivalent of) anevermind. Trove does not have aList<char>.TCharArrayList.