daydreamer daydreamer - 1 year ago 115
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?

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download