title: Map Object Array to Int Array
body: <p>I'm trying to map and filter my Object[] array to int[] array. Works great, if an object is an int, but throws cast exception if not. I'm wondering if I can somehow attach an try/catch in lambda expression? Here's my code:</p>
  
  <pre><code>b[i] = Arrays.stream(item).mapToInt(e -&gt; (int) e).filter(e -&gt; e % 2 != 0).toArray();
  </code></pre>
  
  <p>or better way is just to try/catch whole block?</p>