title: getting array of non null objects
body: <p>I have developed following function to get an array of not null objects:</p>
  
  <pre><code>private static Object[] getArrayNotNulls(Object... objs) {
      return Arrays.stream(objs).filter(Objects::nonNull).toArray();
  }
  </code></pre>
  
  <p>Which I am calling like this:</p>
  
  <pre><code>Object[] x = getArrayNotNulls(1,2, null, 3);
  </code></pre>
  
  <p>This works fine, however, I was wondering, if there is not already a java method that does the same. Something like:</p>
  
  <pre><code>Object[] y = Collections.getArrayNotNull(1,2,null,3)
  </code></pre>
  
  <p>or a mix, I would like to call directly the </p>
  
  <pre><code>Object[] y = Arrays.stream(1,2,null,3).filter(Objects::nonNull).toArray();
  //                         ^^^^^^^^^^
  </code></pre>
  
  <p>but this does not work, since it does not accept Object... arguments</p>