Conor Niall wrote:
I currently have an ArrayList<Integer> that I am trying to convert into a String so that I can output it to a JLabel in my GUI class.
Conor Niall wrote:Any tips for improving this even more?
Conor Niall wrote:Any tips for improving this even more? Or is this as efficient as it's gonna get?
Ron McLeod wrote:Your string will have spaces after the last integer. Since you know the size of the array, you could add some logic to only append the spaces when you are not dealing with the last element of the array.
salvin francis wrote:Well, since trim does a good job here, I would agree with the same. But if it had to be comma,
salvin francis wrote:But if it had to be comma
Ron McLeod wrote:Based on Junilu's suggestion, you could just simply chop-off the delimiter's length off the end of the string.
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |