HashMap in Java | Methods, Use, Example

HashMap in Java is an unordered collection that stores elements (objects) in the form of key-value pairs (called entries). It is expressed as HashMap<Key, Value>, or HashMap<K, V>, where K stands for key and V for value. Both Key and value are objects. HashMap uses an object to retrieve another … Read more

LinkedHashSet in Java | Example Program

LinkedHashSet in Java is a concrete class that implements set interface and extends HashSet class with a doubly linked list implementation. It internally uses a linked list to store the elements in the set. It was added in Java 1.4 version. Java LinkedHashSet class is the same as HashSet class, … Read more

TreeSet in Java | Methods, Example

TreeSet hierarchy in Java

A TreeSet in Java is another important implementation of the Set interface that is similar to the HashSet class, with one added improvement. It sorts elements in the ascending order while HashSet does not maintain any order. Java TreeSet implements SortedSet interface. It is a collection for storing a set … Read more