Convert OptionalDouble to Optional <java.lang.Double> : <p>I have a method that builds a list and I want it to return the average of the list as an Optional value.</p>

<p>However, when I calculate the average value using Java 8, I always get the return value as an OptionalDouble.</p>

<p>How do I convert </p>

<pre><code>OptionalDouble to Optional&lt;Double&gt;?
</code></pre>

<p>Below are my code for average calculation:</p>

<pre><code>private static Optional&lt;Double&gt; averageListValue() {
     // Build list
     List&lt;Double&gt; testList = new ArrayList&lt;&gt;();
     testList.add(...);
     ...
     ...


     return testList.stream().mapToDouble(value -&gt; value).average();
}
</code></pre>

<p>Thanks.</p>
