In contrast to converting an array to list, this example will convert a collection to an array while using java 8, guava and apache libraries.
Straight up Java
Objects
Output
Primitives
Output
Java 8
In java 8, a common operation of java.util.stream is to convert elements to a primitive stream of type Intstream, DoubleStream or LongStream which can accomplished by calling a specialized method stream.mapToInt, stream.mapToDouble and stream.mapToLong respectively. Here, the mapToDouble method is called that returns a DoubleStream and applies the Double.doubleValue to each element returning an array of doubles.
Primitives
Output
Google Guava
Guava's Doubles class provides static utility methods that pertain to double primitives that are not already found in either Double or Arrays. By calling the Doubles.toArray we convert each value to a double and then return an array containing the values of searchEngineMarketShare.
Primitives
Output
Apache Commons
Using apache commons we first convert the list to a Double array and then call ArrayUtils.toPrimitive to convert to a primitive array.