title: How to efficiently remove consecutive same characters in a string
body: <p>I wrote a method to reduce a sequence of the same characters to a single character as follows. It seems its logic is correct while there is a room for improvement in terms of performance, according to my tutor. Could anyone shed some light on this?
  Comments of aspects other than performance is also really appreciated.</p>
  <pre><code>public class RemoveRepetitions {
      public static String remove(String input) {
          String ret = &quot;&quot;;
          String last = &quot;&quot;;
          String[] stringArray = input.split(&quot;&quot;);
  
          for(int j=0; j &lt; stringArray.length; j++) {
              if (! last.equals(stringArray[j]) ) {
                  ret += stringArray[j];
              }
              last = stringArray[j];
          }
  
          return ret;
      }
  
      public static void main(String[] args) {
          System.out.println(RemoveRepetitions.remove(&quot;foobaarrbuzz&quot;));
      }
  }
  </code></pre>