best-practices
4 tutorials tagged “best-practices”.
- Optional Best PracticesWhen to use Optional and when not to: return types yes, fields and parameters no, never null, no bare get, and how to chain map, flatMap and orElse well.
- Stream Best Practices and Common MistakesWrite clear, correct streams: keep lambdas pure, avoid side effects, pick the right operation, know when a loop is better, plus a 10-question checkpoint.
- Virtual Thread Best PracticesUse virtual threads well: never pool them, limit scarce resources with a Semaphore, avoid pinning, watch ThreadLocal, and keep CPU work on platform threads.
- Exception Handling Best PracticesTwelve habits for exceptions that help instead of hurt: fail fast, catch specific types, never swallow, keep the cause, close with try-with-resources.