LinkedHashSet in Java

Java LinkedHashSet Java LinkedHashSet implements the Set interface and extends the HashSet class. It uses the implementation of a doubly-linked list on the hashtable. This means it maintains the insertion order while iterating through the elements. We can retrieve the elements in the same order we insert it. Features of …

Read moreLinkedHashSet in Java

HashSet in Java

What is a HashSet in Java HashSet in Java is a class that implements the Set interface and stores data in a hashtable. It is part of the java.util package. It uses the hashing technique to store and retrieve the elements from the HashSet. During the hashing process, it uses …

Read moreHashSet in Java

TreeSet in Java

TreeSet in Java implements the Set interface and is based on the tree data structure. It is similar to HashSet except that it sorts the data in ascending order. We will see more differences between TreeSet and HashSet towards the end of this tutorial. Java TreeSet Java TreeSet stores only …

Read moreTreeSet in Java

Java Set Example

Java Set interface is an unordered collection of elements that do not contain any duplicate elements. The Set Interface provides features of the mathematical Set in java. In this tutorial, we will cover various Java set examples of Java set methods and their usage. Features of Set interface It contains …

Read moreJava Set Example