Q:

Convert on the fly managed item in a for:each

Let's see this simple scenario:
String ids = "10_20_30_40";
for (String idString : ids.split("_")) {
    int id = Integer.parseInt(idString);
}

There is a way to avoid this conversion and get the int value directly? Something like:
for (int id : Integer.parseEach(ids.split("_"))) {

}

or
for (int id : ids.split("_").stream(...)) {

}

A:

Several options come to mind. It would be good to extract the content of the for loop in a method, say void useId(int id)
You could use Pattern::splitAsStream:
Pattern underscore = Pattern.compile("_");
underscore.splitAsStream(ids)
        .mapToInt(Integer::parseInt)
        .forEach(this::useId);

Or you could simply stream the result of split:
Arrays.stream(ids.split("_")).mapToInt(...)...

Or, you could create an array:
for (int id : underscore.splitAsStream(ids).mapToInt(Integer::parseInt).toArray()) {

}

or... you could keep your for loop!

