Skip to main content

Java

2025


Why Do Java Methods Modify Objects but Not Primitives?

5 mins
Many new Java developers are surprised when a method quietly modifies an object but leaves a primitive variable untouched. Java parameter passing is always by value, but understanding how that works with objects versus primitives will help you avoid unexpected behavior.

3 Annotations to Speed Up Spring Bean Startup

7 mins
Without having to radically change the Beans in your Spring Boot application, you can significantly speed up Spring bean startup times, just by using Annotations such as @Lazy, @Async, and @Profile.

Handling ExecutionException - tips for Writing Robust Concurrent Code

2 mins
Handling an ExecutionException in Java requires understanding its root cause and applying the right strategy to ensure smooth execution in concurrent environments. Practical solutions include unwrapping the exception with getCause() and implementing structured error handling.

Speeding up JAXB with caching and pooling - with benchmarks

8 mins
Caching JAXB instances can significantly improve performance in Java applications. It reduces the overhead of creating new instances and allows for better resource management. See benchmarks comparing caching vs. non-caching approaches.

2024


Understanding Java Enum Constructors: Beyond Basic Constants

4 mins
Java enums are more than just simple constants. By using constructors in enums, they can eliminate the need for cumbersome if-then statements, and attach meaningful attributes to each constant, making the code more maintainable and expressive.

Use Java Optionals For Safer, Cleaner and Functional Code

6 mins
In Java, handling null values can lead to messy code and potential NullPointerExceptions. With the introduction of Optionals in Java 8, you can write safer, cleaner, and more functional code by effectively managing the absence of values.