Java8 Optional for replacing a method that throws multiple exceptions

In some code, we have various exceptions during its execution. I want to replace the exceptions Optional; but can optionally inform users only that the value does not exist. I need more information about the various problems that occur at runtime. I need this information mainly for error messages and getting the correct error code.

How can I use it Optionalin this case?

+4
source share
1 answer

Optional , , .

null, , Optional , @NotNull, , / .

.

+4

All Articles