title: is it always safe to use the first element of the array returned by split?
body: <p>I'm pretty sure the answer is yes, but I just want to confirm that there is never a situation where a non null string (regardless of what it contains) would return anything but a valid String as the first member of the array returned by split. </p>
  
  <p>In other words.</p>
  
  <pre><code>String foo = ""; // or "something" or "a b c" or any valid string at all
  
  String[] bar = foo.split(",")[0];
  </code></pre>
  
  <p>My understanding is that bar will never be null and the assignment line has no way to fail. If the delimiter is not found in the string it just returns foo in its entirety as the first element of the returned array.</p>