Java Records — Etched in Finality

This article uses a story format to show the concept of records in Java. It shows the different concepts and parts that make up the records, including a restricted identifier, java.lang.Record, Components, Canonical, Compact, Normal constructors, and more.

The Minimalist — A Resolution

Working from home has taught some of us to think of being minimalistic. It was no different for our protagonist, “Dev” — Dev decided to be minimalistic with respect to some of the dresses — So he decided to keep track of what he was wearing to donate the new dresses. To keep it simple, he decided to keep track of two items, shirts and shoes, and wrote the following class in Java:

Brewing Patterns in Java: An Informal Primer

Not so long ago, Java lovers were engulfed by a mammoth addition — yes, we all know, right? — the Lambda Expressions in Java 1.8! Eclipsed by lambda, minor in its avatar for the oblivious, was another message — “should not be used as an identifier, since it is a reserved keyword from source level 1.8 on” — caught by the eyes of the assiduous and the pedantic; Wait, did I miss anything? hmm… Yes, like some of us who missed out that this article began with _, an underscore. An underscore was being removed as a legal identifier, quietly — and it was being promoted (ssshhh.. underscore does not know yet) to a more complex role — it was just another sign of times to come — the time has come to Match Patterns in Java!

ABCs of Pattern Matching

So what is pattern matching? All those Unix fans out there would suddenly remember the good old awk; Wikipedia says “AWK .. used as a data extraction...tool;… A line is scanned for each pattern in the program, and for each pattern that matches, the associated action is executed.” — A Given Pattern is matched, Data is extracted and Some action is taken — with or without the data. If this sounds too involved, we will be surprised to know that we have been using this all along — The Find and Replace options all of us are very familiar with.