5 Replies Latest reply: Dec 19, 2006 4:03 PM by 807599 RSS

    StringBuffer and String


      I have list of string objects (very big list) and want to combine those strings together. I used two methods:

      String myString="";
      for (int i=0; i< myList.size() i++){
      myString = myString + (String)myList.get(i);
      return myString
      String Buffer myStringBuffer= new StringBuffer();
      for (int i=0; i< myList.size() i++){
      myStringBuffer = myStringBuffer.append((String)myList.get(i));
      return myStringBuffer

      The second method run very fast. Could you please tell me why

      Thanks for any help