title: Why in Java 8 split sometimes removes empty strings at start of result array?
body: <p><strong>Before Java 8</strong> when we split on empty string like</p>
  <pre><code>String[] tokens = &quot;abc&quot;.split(&quot;&quot;);
  </code></pre>
  <p>split mechanism would split in places marked with <code>|</code></p>
  <pre><code>|a|b|c|
  </code></pre>
  <p>because empty space <code>&quot;&quot;</code> exists before and after each character. So as result it would generate at first this array</p>
  <pre><code>[&quot;&quot;, &quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;&quot;]
  </code></pre>
  <p>and later will <a href="https://stackoverflow.com/a/29972465/1393766">remove trailing empty strings</a> (because we didn't explicitly provide negative value to <code>limit</code> argument) so it will finally return</p>
  <pre><code>[&quot;&quot;, &quot;a&quot;, &quot;b&quot;, &quot;c&quot;]
  </code></pre>
  <hr />
  <p><strong>In Java 8</strong> split mechanism seems to have changed. Now when we use</p>
  <pre><code>&quot;abc&quot;.split(&quot;&quot;)
  </code></pre>
  <p>we will get <code>[&quot;a&quot;, &quot;b&quot;, &quot;c&quot;]</code> array instead of <code>[&quot;&quot;, &quot;a&quot;, &quot;b&quot;, &quot;c&quot;]</code>.</p>
  <p>My first guess was that maybe now <em>leading</em> empty strings are also removed just like <em>trailing</em> empty strings.</p>
  <p>But this theory fails, since</p>
  <pre><code>&quot;abc&quot;.split(&quot;a&quot;)
  </code></pre>
  <p>returns <code>[&quot;&quot;, &quot;bc&quot;]</code>, so leading empty string was not removed.</p>
  <p>Can someone explain what is going on here? How rules of <code>split</code> have changed in Java 8?</p>