-
Simple comparison between List.of() and Collections.unmodifiableList()
Here’s a simple comparison between List.of() and Collections.unmodifiableList() Key Differences List.of() Collections.unmodifiableList() Java Version Java 9+ Java 1.2+ Backed by the original list ❌ No ✅ Yes Allows null elements ❌ No ✅ Yes (if original list has them) Reflects changes in the original ❌ No ✅ Yes Immutable or Unmodifiable ✅ Truly immutable ✅…
-
Yield Statement
The yield statement is used in a switch expression to exit a case and return a value. This value becomes the result of the entire switch expression. The expression after yield must not be void. In a switch expression, use yield to return a value. return exits a method, not a switch case. Feature yield…
-
Var Type Identifier
The var keyword can only be used for local variables inside methods, constructors, or initializer blocks. It can’t be used for fields or parameters. Additionally, the variable must be initialized immediately so the compiler can determine its type—null alone is not sufficient. Reference https://dev.java/learn/language-basics/using-var
-
Spring Boot Annotations
@SpringBootApplication @SpringBootApplication is an annotation in the Spring Framework for Java that indicates that a class is a Spring Boot application. This annotation combines several other annotations, including @Configuration, @EnableAutoConfiguration, and @ComponentScan, into a single convenient annotation. The @Configuration annotation indicates that the class is a source of bean definitions for the application context. The…
-
Deserializing JSON to an abstract class, interface, or to inherited objects in Spring Boot Webclient
@JsonTypeInfo and @JsonSubTypes annotations. First, you need to ensure that your classes are properly annotated for serialization and deserialization. You can use the @JsonTypeInfo and @JsonSubTypes annotations to specify the type hierarchy of your objects @JsonSubTypes with not matching any conditions and return as null If you have a JSON object that does not match…
-
Hazelcast, Ignite, Aerospike, Redis Cache Comparison
Hazelcast Ignite Aerospike Redis In-memory key-value store Primary database model – Key-value store Secondary database models – Document store Java Language For open source Apache License 2.0 In-memory computing platform Distributed database Java Language, Java, C#, C++, SQL For open source Apache License 2.0 In-memory NoSQL Database Primary database model – Key-value store Secondary database…
-
Observability
Observability is a key requirement for monitoring and debugging microservice architectures. With the rise of distributed systems and the increasing complexity of modern software applications, observability has become an essential component of any production system. Observability in microservices involves the ability to gather and analyze data from each individual microservice to provide a comprehensive view…
