As I would like to improve my coding style, I try to find the best practices or some rules for this issue. In my previous projects, we used to check and treat every input parameter inside the function, (for example if it is not null).
Now, I have read here in some answers and also in Pragmatic Programmer book, that the validation of input parameter is responsibility of caller.
In either case, you have a documented precondition on your function: no argument may be null.
You could instead extend the domain of the function to include nulls with defined behavior, e.g. Of course, that's again my C heritage speaking here - in Java, it's common enough to document preconditions this way.
For example, the error message that displays when the component’s value exceeds the maximum value allowed by Tags for information on how to display validation error messages on the page when validation fails.
Instead of using the standard validators, you can use Bean Validation to validate data. To validate a component’s value using a particular validator, you need to register that validator on the component.
They also support I/O on files and between programs, but that feature is controlled by the command line interpreter, not the program.
The Java platform supports three Standard Streams: .Standard Streams are a feature of many operating systems.By default, they read input from the keyboard and write output to the display.For more information, refer to the documentation for your command line interpreter.You might expect the Standard Streams to be character streams, but, for historical reasons, they are byte streams.But not all preconditions even be reasonably checked.