title: Lambda on primitive arrays
body: <p>I am trying to convert a <code>double[]</code> to <code>float[]</code> using Java 8 lambda calculus. So far, I just created a toy method which should be revised. Trying to find help for converting primitive arrays. Mostly, is there any approach to get rid of the guava conversion because converting to List and back are too heavy for large arrays.</p>
  
  <pre><code>import com.google.common.primitives.Floats;
  
  public static float[] doubleToFloat(double[] vector) {
      Float[] f = Arrays.stream(vector).&lt;Float&gt;mapToObj(x -&gt; (float) x).toArray(Float[]::new);
      return Floats.toArray(Arrays.asList(f));
  }
  </code></pre>