4 Key differences between a HashMap and a Hashtable in Java

4 Key differences between a HashMap and a Hashtable in Java

Overview Hashtable and HashMap are common data structures to store key-value data in your Java application. While having similarities, there are some crucial differences you need to know as a Java developer. Let’s discuss the differences between these two data structures in this post. Hashtable is thread-safe, HashMap is not Consider the following code using … Read more

Java Exception Handling Cheat Sheet

Java Exception Handling Cheat Sheet

Overview While preparing for the OCP 17 exam, I created some notes to aid my learning. This is the first of many posts in this series. I hope you find it helpful. Java Exception Handling Cheat Sheet The Throwable family Checked vs. unchecked exceptions Overriding methods with declared exceptions Example RuntimeException Checked exceptions Error Exception … Read more

Guide to ConcurrentModificationException

Guide to ConcurrentModificationException

Introduction If you run the following code: There are chances you will get the following exception: I said “there are chances” because you run the same code repeatedly, and sometimes there is no exception thrown. So, what is ConcurrentModificationException and when you might encounter it. The JDK’s said: This exception may be thrown by methods … Read more