Skip to content

Tag Archives: Java-Set-Programs

Hashset: Hashset in Java is generally used for operations like search, insert and delete. It takes constant time for these operations on average. HashSet is… Read More
In this article, we will learn, the difference between HashSet vs LinkedHashSet and TreeSet And similarities between LinkedHashSet and TreeSet. HashSet, LinkedHashSet, and TreeSet all… Read More
Here are couple of differences between ArrayList and HashSet. Inheritance: Implementation: Implementation : ArrayList implements List interface while HashSet implements Set interface in Java. Internal… Read More
In this article you will learn difference between LinkedList and LinkedHashSet in java. Prerequisite: LinkedList : LinkedHashSet LinkedList class implements the List and Deque interface… Read More
Given a TreeSet in Java, task is to sort elements of TreeSet in Descending Order (descreasing order).Examples:  Input : Set: [2, 3, 5, 7, 10,… Read More
Given a HashSet in Java, the task is to sort this HashSet. Examples: Input: HashSet: [Geeks, For, ForGeeks, GeeksforGeeks] Output: [For, ForGeeks, Geeks, GeeksforGeeks] Input:… Read More
Given a TreeSet in Java, the task is to loop over this TreeSet. TreeSet provides an implementation of the SortedSet Interface and SortedSet extends Set… Read More
HashSet is implementation of Set Interface which does not allow duplicate value. The main thing is, objects that are stored in HashSet must override equals()… Read More
Given a Set of String, the task is to convert the Set to a comma separated String in Java. Examples: Input: Set<String> = ["Geeks", "ForGeeks",… Read More
Given a Set of Strings, the task is to convert the Set into an Array of Strings in Java. Examples: Input: Set<String>: ["ForGeeks", "A Computer… Read More
An array is a group of like-typed variables that are referred to by a common name. An array can contain primitives data types as well… Read More
Java Set is a part of java.util package and extends java.util.Collection interface. It does not allow the use of duplicate elements and at max can… Read More
Java Set is a part of java.util package and extends java.util.Collection interface. It does not allow the use of duplicate elements and at max can… Read More
Java Set is a part of java.util package and extends java.util.Collection interface. It does not allow the use of duplicate elements and at max can… Read More
Java Set is a part of java.util package and extends java.util.Collection interface. It does not allow the use of duplicate elements and at max can… Read More