title: Split String - the Cartesian way
body: <p>Given the following string:</p>
  
  <p><code>"foo bar-baz-zzz"</code></p>
  
  <p>I want to split it at the characters " " and "-", preserving their value, but get all combinations of inputs.</p>
  
  <p>i want to get a two-dimensional array containing</p>
  
  <pre><code>{{"foo", "bar", "baz", "zzz"}
  ,{"foo bar", "baz", "zzz"}
  ,{"foo", "bar-baz", "zzz"}
  ,{"foo bar-baz", "zzz"}
  ,{"foo", "bar", "baz-zzz"}
  ,{"foo bar", "baz-zzz"}
  ,{"foo", "bar-baz-zzz"}
  ,{"foo bar-baz-zzz"}}
  </code></pre>
  
  <p>Is there any built-in method in Java to split the string this way? Maybe in a library like Apache Commons? Or do I have to write a wall of for-loops?</p>