In C# I have the following code:
string[] exampleStrings = Console.ReadLine().Split(' '); // C#
int[] exampleInts = exampleStrings.Select(int.Parse).ToArray();
The .Select can also be like this: .Select(x => int.Parse(x))
That way I get really quickly an int[].
I started learning Java a few days ago and I am yet to get used to it.
I have the following code in Java:
Scanner scan = new Scanner(System.in); // Java
String[] javaStrings = scan.nextLine().split(" ");
And I would like to convert this String[] javaStrings into int[] foo. If there is no way to do it like in C# I think then a loop will maybe be the only way.
Thank you in advance.