Category Archives for "Java"

Immutable Collections in Java 9

1.Overview The arrival of Java 9 brings many new features to Java’s Collections API, one of which being collection factory methods which adds syntactic sugar for creating small unmodifiable Collection instances using new convenience factory methods as per JEP 269. In this article, we will discuss the usage and implementation details. 2. Motivation Let’s start […]

Continue reading

SQL-like operations with Java using Streams

1. Overview Nearly every Java application makes and processes collections to group and process the data. To process the data from collections, we write lot of boiler plate code. Typical processing patterns on collections are similar to SQL-like operations such as “finding”, “grouping” etc. Most databases lets to specify such operations declaratively like the below […]

Continue reading

Checked or Unchecked Exceptions?

1. Overview In Java, there are basically two types of exceptions: Checked exceptions and Unchecked exceptions (RuntimeException and Error). The differences between checked, unchecked and error are: Checked Exceptions must be explicitly caught or propagated. Unchecked exceptions do not have this requirement. They don’t have to be caught or declared thrown. Checked Exceptions in Java […]

Continue reading

Java HashMap equivalent in C#

HashMap maintains key and value pairs and often denoted as HashMap<Key, Value> or HashMap<K, V>. HashMap implements Map interface. HashMap is similar to Hashtable with two exceptions – HashMap methods are unsynchornized and it allows null key and null values unlike Hashtable. It is used for maintaining key and value mapping. What is equivalent to HashMap […]

Continue reading

Java 9 Modularity

Have you ever experienced at runtime (Its because of missing dependencies) and spent hours and days trying to track down irreproducible bugs in your production environment, just to find out that somehow two versions of 3rd party dependencies have managed to sneak into your classpath. Tracking them down is a painful experience eventhough we use […]

Continue reading