Optional is primarily intended for use as a method return type where there is a clear need to represent “no result,” and where using null is likely to cause errors. … You should almost never use it as a field of something or a method parameter.
Optional is primarily intended for use as a method return type where there is a clear need to represent “no result,” and where using null is likely to cause errors. … You should almost never use it as a field of something or a method parameter.