Skip to main content

Practice ยท 3 of 3

Optional at the boundary

Write parsePort(String input): return Optional of the parsed port when input is a valid number in 1..65535; Optional.empty() otherwise (null, blank, non-numeric, or out of range).

Difficulty: advanced

Back to lesson: Practice: Practice: Pipelines at Work