I have a stream of strings:
Stream<String> st = Arrays.stream(new String[]{"10", "20", "30", "40", "50"});
I want to convert them to integer and sum them up using the reduce method. I'm using reduce in the following format:
int result = st.reduce(0, (a, b) -> a + Integer.parseInt(b));
I get this error:
no suitable method found for reduce(int, (a, b) -> a + [...]nt(b))
any hint about how can I rewrite the reduce method to make it work?