Sep 12, 2023
I usually return type Optional<T> mostly in the utility methods and in some methods required in the business logic classes. A simple example:
Optional<User> user = findUserById(int id);
Instead of dealing of null user, Optional is better option to handle. I use this return type in service class to return a suitable response.
The names of the method calls, well I don't mind it. Maybe I got used to them.