Category: Collections

The Internal Cache of Integers 0

The Internal Cache of Integers

Instances of Integer and other wrapper classes are cached by the JVM for increased performance. package collections;   public class IntegerCache { private static void test(Integer i, Integer i2) { System.out.println(i); if (i ==...

Jave Treemap – Its internal working and implementation 0

Jave Treemap – Its internal working and implementation

TreeMap is one of the mostly used Java collection after HashMap. TreeMap is Red-Black tree based NavigableMap implementation. It is sorted according to the natural ordering of its keys. Lets see how it works...

How HashMap works – Its internal implementation 0

How HashMap works – Its internal implementation

HashMap is one of the most commonly used collections in Java. Using it is pretty easy but understanding its implementation can get  a little complicated. Here is a simple example which we will use...