title: Weird Issue reading to a TreeSet
body: <p>I seem to be having a weird issue where it is faster to read a file into an <code>ArrayList</code> and from that <code>ArrayList</code> read it to a <code>TreeSet</code> than to add the data directly to the <code>TreeSet</code>. I can't seem to understand the problem.</p>
  
  <pre><code>public TreeSet&lt;String&gt; readFile(){
      TreeSet&lt;String&gt; dict = null;
      try {
          dict = new TreeSet&lt;String&gt;();
          BufferedReader in = new BufferedReader(new InputStreamReader(getAssets().open("dictionary")));
          String line;
  
          while ((line = in.readLine()) != null) {
              line = line.split(SEPARATOR)[0];
              dict.add(line);
          }
  
      }catch (FileNotFoundException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
      }
  
      return dict;
  }
  </code></pre>
  
  <p>Also this problem seems to be related with the split function since it works at normal speed without it.<br>
  My input file haves around 160 000 lines.<br>
  ArrayList with TreeSet takes around 2000 ms.<br>
  TreeSet takes around 100 000 ms.    </p>
  
  <p>ArrayList -> TreeSet Code</p>
  
  <pre><code>public TreeSet&lt;String&gt; readFile(){
      ArrayList&lt;String&gt; dict = null;
      try {
          dict = new ArrayList&lt;String&gt;();
          BufferedReader in = new BufferedReader(new InputStreamReader(getAssets().open("dictionary")));
          String line;
          while ((line = in.readLine()) != null) {
              line = line.split(SEPARATOR)[0];
              dict.add(line);
          }
      }catch (FileNotFoundException e) {
          e.printStackTrace();
      } catch (IOException e) {
          e.printStackTrace();
      }
      TreeSet&lt;String&gt; tree = new TreeSet&lt;String&gt;();
      for(String word:dict){
          tree.add(word);
      }
      return tree;
  }
  </code></pre>
  
  <p>Currently using OnePlus One with Cyanogenmod for the tests.</p>