Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
according to my introduction to logic (or was it structired programming? cant remember) class, doing that is considered "defensive programming" and isn't a good practice.
to clarify, i think they mean doing checks like that when they arent needed. if the excercise says the input will always be a valid string, then you shouldnt do a check for that
Its allways better to check like
if(name == null) throw new IllegalArgumentException("name must not be null");
even if the description says that only valid strings appear
Names given are always valid strings.
Nested ternary operators are a bad practice. Ternary operators should not be nested (java:S3358) (Code Smell)
This comment is hidden because it contains spoiler information about the solution
A linting tool will warn you about the use of nested ternary operators. This reduces clarity.
I'll never use Streams for small data, or simple loops like this one. This is easily a one liner with a for loop and the gain in readability is probably none.
You know your Series buddy. Excellent solution I guess that could be the difference between a programmer and an Engineer.
name is an object, so I think checking for null should be done.