Asked by AppdroidsmenaComputer Science πŸ–₯

What is the best way of concatenating strings found in an array of length n?

Profile picture

Anna Chase

Knowledgeable, Calm and Patient tutor

you should be using ArrayLists, and your output should be an ArrayList. Once you've made these your pre-condition, the operation is built-in--first.addAll(second). The only case where this wouldn't be pretty much automatic is when your arrays are non-object types (int, long, double, ...), in that case, intrinsic arrays can have a big advantage over ArrayLists--but for Strings

Profile picture

Michael Wiggins

I am passionate about teaching, and have more than 10 years of experience

String ccyPair = ccy1 + ccy2; I\'m utilizing cyPair as a key in a HashMap and it\'s brought in a tight circle to recover esteems. When I profile then this is the bottleneck java.lang.StringBuilder.append(StringBuilder.java:119) java.lang.StringBuilder.(StringBuilder.java:93)

Answers from these tutors

Find me a tutor

We take your privacy seriously. View our policy.