How Garbage Collection works in WeakHashMap
Here we will discuss about how an entry gets garbage collected from WeakhashMap. You may check first how garbage collection works in Java. WeakHashMap uses a special class…
Here we will discuss about how an entry gets garbage collected from WeakhashMap. You may check first how garbage collection works in Java. WeakHashMap uses a special class…
Here I am going to discuss about the StrongReference, PhantomReference, WeakReference and SoftReference. Reference classes are important in the context of how garbage collection works in Java memory…
Introduction Here we will see an example on creating a custom HashMap in Java. We have seen the built-in implementation of HashMap in Java API and we know…
In this example I am going to show you how to iterate over map of list of objects. Let’s say you have keys as strings and values as…
Introduction In this tutorial, I will show you how you are going to collect and convert objects using lambda expression in Java 8 stream API. I will collect…
Java 8 Filter This tutorial will show you how to use Java 8 stream API‘s filter() and map() methods. The filter() method in Java 8 or onward is…
In this example I am going to show you an example on using Comparator in HashMap will show you how to use Comparator to sort values in HashMap.…
Java Custom Object In this Java HashMap example I am going to tell you how to use custom object as a key in HashMap. In custom object as…
What is WeakHashMap WeakHashMap is based on Hash table implementation of the Map interface but with weak keys. An entry in a WeakHashMap will automatically be removed when…
What is LinkedHashMap A LinkedHashMap like HashMap is a simple yet powerful way to store and get data. Unlike HashMap, LinkedHashMap is based on HashTable and Linked list…