daydreamer daydreamer - 8 months ago 37
Java Question

How to convert String Array to Double Array in one line

I have a string array as:

String[] guaranteedOutput = Arrays.copyOf(values, values.length,

All the String values are numbers. The data should be converted to a


Is there a one line solution in Java to achieve this or we need to loop and convert each value to a Double?


Create a method implementing it using a loop, then call your method, and you'll have a one-line solution.

There is no buit-in method in the Java API to do that.