In this article, I will provide a brief and meaningful overview of sequenced collections in Java 21. What Is A Sequenced Collection? According to JEP 431, a sequenced collection is a Collection whose elements have a defined encounter order. A sequenced collection has first and last elements. Every element between the first and last one has successors … [Read more...] about Sequenced Collections in Java 21
Java Language
JEP 444 Proposes to Finalize the Virtual Threads in JDK 21
In this brief article, I will cover the overall idea of virtual threads in Java. "Virtual threads are lightweight threads that dramatically reduce the effort of writing, maintaining, and observing high-throughput concurrent applications." - JEP 444. [JEP stands for JDK Enhancement Proposal] Virtual threads were first introduced in JDK 19 as a preview feature under the JEP … [Read more...] about JEP 444 Proposes to Finalize the Virtual Threads in JDK 21
Important Note – Java equals Method and Inheritance
In this article, we will check a few important points on overriding equals() method when we are using inheritance. We consider two scenarios: We will discuss the point with concrete examples for quick understanding. Scenario 1 - Semantics of equals changes in subclass Suppose, we have designed a class named Super as follows: We have also designed another class … [Read more...] about Important Note – Java equals Method and Inheritance
Solid Code Design – Part 6 – Advanced Java Generics
In Part 4 and Part 5, I introduced you with the concept of invariance and covariance respectively. In this article, I will cover contravariance. We will use the same type hierarchies and code from the Part 5. For your convenience, I will provide the type hierarchies once again here. Contravariance To take advantage of covariance, we use lower bounded wildcards as … [Read more...] about Solid Code Design – Part 6 – Advanced Java Generics
Solid Code Design – Part 5 – Advanced Java Generics
In Part 4, I introduced you with the concept of invariance. In this article, I will cover covariance. I will use the below type hierarchies for our discussion. Get Started To start, I will introduce you with the code for the above type hierarchies as given below. I will also introduce with the below generic class. For our convenience, I will … [Read more...] about Solid Code Design – Part 5 – Advanced Java Generics