title: How do I make Java ignore the number of spaces in a string when splitting?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/225337/how-do-i-split-a-string-with-any-whitespace-chars-as-delimiters">How do I split a string with any whitespace chars as delimiters?</a>  </p>
  </blockquote>
  
  
  
  <p>Both of these Python lines gives me exactly the same list:</p>
  
  <pre><code>print("1 2 3".split())
  print("1  2   3".split())
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>['1', '2', '3']
  ['1', '2', '3']
  </code></pre>
  
  <p>I was surprised when the Java 'equivalents' refused:</p>
  
  <pre><code>System.out.println(Arrays.asList("1 2 3".split(" ")));
  System.out.println(Arrays.asList("1  2   3".split(" ")));
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>[1, 2, 3]
  [1, , 2, , , 3]
  </code></pre>
  
  <p>How do I make Java ignore the number of spaces?</p>