92. Introducing record pattern for instanceof In order to introduce record patterns we need a record, so here is one: public record Doctor(String name, String specialty) implements Staff {} This
Category: Certification Exams of Java
Introducing record pattern for switch – Record and record patternIntroducing record pattern for switch – Record and record pattern
93. Introducing record pattern for switch You already know that type patterns can be used for instanceof and switch expressions. This statement is true for record patterns as well. For
Tackling guarded record patterns – Record and record patternTackling guarded record patterns – Record and record pattern
94. Tackling guarded record patterns Exactly as in the case of type patterns, we can add guarding conditions based on the binding variables. For instance, the following code uses guarding
Using generic records in record patterns 2 – Record and record patternUsing generic records in record patterns 2 – Record and record pattern
This time, if we call buyFruit(seed) we get the message, This is a seed of Fairytale from India. The call matches the case SeedRecord(String type, String country) branch. And, if
Using generic records in record patterns – Record and record patternUsing generic records in record patterns – Record and record pattern
95. Using generic records in record patterns Declaring a generic record for mapping fruit data can be done as follows: public record FruitRecord<T>(T t, String country) {} Now, let’s assume
Tackling records in Spring Boot – Record and record patternTackling records in Spring Boot – Record and record pattern
98. Tackling records in Spring Boot Java records fit perfectly in Spring Boot applications. Let’s have several scenarios where Java records can help us to increase readability and expressiveness by
Tackling records in JPA – Record and record patternTackling records in JPA – Record and record pattern
99. Tackling records in JPA If you are a fan of JPA (I cannot see why, but who am I to judge) then you’ll be more than happy to find
Tackling records in jOOQ – Record and record patternTackling records in jOOQ – Record and record pattern
100. Tackling records in jOOQ The more you learn JPA more you’ll love jOOQ. Why? Because jOOQ represents the best way to write SQL in Java. Flexibility, versatility, dialect agnostic,
Introducing parallel computations with arrays – Arrays, collections and data structuresIntroducing parallel computations with arrays – Arrays, collections and data structures
101. Introducing parallel computations with arrays There was a time when CPUs were capable to perform operations on data only in the traditional mode known as SISD (Single Instruction, Single
Covering Vector API structure and terminology 3 – Arrays, collections and data structuresCovering Vector API structure and terminology 3 – Arrays, collections and data structures
Creating vectors of same primitive value Creating a vector and loading it up with a primitive value can be quickly accomplished via the broadcast() method as follows: [5, 5, 5,