5 ms·
My rule of thumb is that if you want to keep your code clean, always returning an empty collection is preferable to returning an empty response on that branch.
by greybeard69 4mo ago
My rule of thumb is that if you want to keep your code clean, always returning an empty collection is preferable to returning an empty response on that branch. You don't need a guard clause to null/undef-check before consuming the result. The rule applies whether we're consuming the response from a repository or an http request.