title: Performance of StringTokenizer class vs. String.split method in Java
body: <p>In my software I need to split string into words. I currently have more than 19,000,000 documents with more than 30 words each.</p>
  
  <p>Which of the following two ways is the best way to do this (in terms of performance)?</p>
  
  <pre><code>StringTokenizer sTokenize = new StringTokenizer(s," ");
  while (sTokenize.hasMoreTokens()) {
  </code></pre>
  
  <p>or</p>
  
  <pre><code>String[] splitS = s.split(" ");
  for(int i =0; i &lt; splitS.length; i++)
  </code></pre>