Perl if, else, elsif ("else if") syntax
Perl if, else, elsif ("else if") syntax By Alvin Alexander. Last updated: July 23 2016 Summary: This tutorial shows a collection of Perl if, else, and else if examples. Here are some examples of the...
View ArticleA Java “instanceof null” example
A Java “instanceof null” example By Alvin Alexander. Last updated: September 20 2019 You might think that when the Java instanceof operator is used to test a null reference, such as a null reference...
View ArticleA Java instanceof array example
A Java instanceof array example By Alvin Alexander. Last updated: September 30 2019 While working with various "Java instanceof" tests recently, my curiosity was piqued, and I thought I'd take a look...
View ArticleScala, isInstanceOf, inheritance, getClass, and equals (equality)
Scala, isInstanceOf, inheritance, getClass, and equals (equality) By Alvin Alexander. Last updated: August 9 2017 I was doing a little Scala programming this morning, and because I hadn't written any...
View ArticleHow to compare String equality in Java
How to compare String equality in Java By Alvin Alexander. Last updated: March 30 2017 Java String comparison FAQ: Can you share some examples of how to compare strings in Java? If you’re like me,...
View ArticleHow to test String equality in Scala
How to test String equality in Scala By Alvin Alexander. Last updated: July 9 2017 This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 1.1, “Testing String...
View ArticleUnix/Linux code to test whether “today” is a weekend day (or weekday)
Unix/Linux code to test whether “today” is a weekend day (or weekday) By Alvin Alexander. Last updated: January 27 2018 If you ever need an example of a Unix/Linux shell script where you need to...
View ArticleA collection of 100+ Scala String examples
A collection of 100+ Scala String examples By Alvin Alexander. Last updated: July 16 2019 This page contains a collection of over 100 Scala String examples, including strings functions, format...
View ArticleYoda Conditions
Yoda Conditions By Alvin Alexander. Last updated: May 5 2019 Read more about Yoda Conditions I had never heard of the term “Yoda Conditions” until now, but I have seen them in some Java code where...
View ArticleHow to define an `equals` method in a Scala class (object equality)
How to define an `equals` method in a Scala class (object equality) By Alvin Alexander. Last updated: June 10 2019 Table of Contents Solution A Scala `equals` method example Discussion Example 2: A...
View Article