A Nicer Way to Parse main() Arg to an Integer? #java #shorts #coding #airhacks

Using Arrays.stream() (https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/Arrays.html#stream(T%5B%5D)) to convert the main() arguments to a Stream and to convert the first parameter to an Integer.

Java used in this short: openjdk version “25” 2025-09-16 LTS

I regularly publish the most popular or interesting shorts here: https://github.com/AdamBien/best-of-java-shorts/

Visual Studio Code used for editing: https://code.visualstudio.com/

See you at live, virtual workshops: https://airhacks.live
About me: https://airhacks.industries

#airhacks