In this article, we will discuss a few memory management concepts in Java with a heavy focus on the interaction between the Garbage Collector and the different reference objects available.
This is no introduction, so let us mutually agree that you have Java Heap and GC basics down. Many articles cover this topic quite well, and you might actually wonder why am covering something that is already well discussed over the www.
Lambda expressions are the most popular feature of Java 8. They introduce functional programming concepts to Java, which is a completely object-oriented and imperative programming language.
How functional programming languages work is beyond the scope of this article, but we will extract a feature that will make the difference obvious for us who work with OOP.
In this post, we are going to discuss yet another feature of Java 8: Method References. In a previous post, we explored lambda expressions and learned how to use them to write better and more compact Java code, especially with the advent of functional interfaces.
Unless you are very well-versed with lambda expressions, I would highly recommend that you first go through my lambda expressions tutorial before continuing with this post.
To even encourage you further, when you understand lambda expressions, method references are a walk over.
HashMap
is perhaps the most popular implementation of the Map
interface in Java Collections Framework (JCF). If you want to fully understand the internal workings of HashMap
, the best tutorial I have found online is here.
For this article, we are only going to focus on the performance specific concepts. HashMap
offers us a very fast, well-optimized data structure solution for many problem scenarios.