java - Which class to use for this static method, StringBuffer or StringBuilder? -


for following code, class should use in static method, stringbuilder or stringbuffer? based on api, stringbuffer thread-safe, stringbuilder not.

public static string getstring(int[] arrs) {     stringbuilder sb = new stringbuilder();  //1     stringbuffer sb = new stringbuffer();    //2     (int : arrs) {         sb.append(i);     }     return sb.tostring(); } 

it's method-local variable, won't have concurrent access there... use stringbuilder


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -