title: How to filter out only digits in a given string using Stream API?
body: <p>I'm given an assignment in which I have an array of strings. And my task is to filter out the digits only and save them in an array of Integer using the Stream API. So far I have done this:</p>
  
  <pre class="lang-java prettyprint-override"><code>String [] data={"Mehrose-150891","Rachel-150892","Roni-148269"}
  
  
   Integer[] digitsOnly= Arrays.stream(data)
                         .map(x-&gt;new Character((char)x))
                         .filter(Character::isDigit)
  </code></pre>
  
  <p>I am given an error on a call of map <strong>Can not cast from String to char</strong>, if I can get an explanation on this that would be helpful. Moreover, I don't have any idea how do I directly get an array of Integer rather than to get a list of Character. </p>