String[] array = new String[] {"1", "2", "3", "25"};
I want to find the maximum number inside this string and return it as integer.
What is the best way, especially regarding performance, since I have to parse several million lines with it?
Two solutions that I can think of:
Arrays.stream(array).mapToInt(Integer::parseInt).max().orElse(0);
Integer.valueOf(Collections.max(Arrays.asList(array)));
source
share