Courses
Tutorials
Practice
Data Structure
Java
Python
HTML
Interview Preparation
DSA
Practice Problems
C
C++
Java
Python
JavaScript
Data Science
Machine Learning
Courses
Linux
DevOps
SQL
Web Development
System Design
Aptitude
GfG Premium
Similar Topics
DSA
22.5K+ articles
Java
10.5K+ articles
Mathematical
7.8K+ articles
Arrays
6.5K+ articles
Java-Functions
4.1K+ articles
Difference Between
3.6K+ articles
Java Programs
1.9K+ articles
Sorting
1.8K+ articles
Java - util package
1.5K+ articles
Java-Comparable
10+ articles
Java-Comparator
21 posts
Recent Articles
Popular Articles
Compare Strings for equality or lexicographical order in different programming Languages
Last Updated: 09 November 2023
Given two strings string1 and string2, the task is to check if these two strings are equal or not.Examples:Input:string1 = “GeeksforGeeks”, string2 = “GeeksforGeeks”Output...
read more
Picked
Java-Comparator
DSA
Maximum number of plates that can be placed from top to bottom in increasing order of size
Last Updated: 27 January 2023
Given a 2D array plates[][] of size N, which each row representing the length and width of a N rectangular plates, the task is to find the maximum number of plates that ca...
read more
Dynamic Programming
Sorting
Mathematical
subsequence
LIS
Recursion
Java-Comparator
DSA
Sort Java Vector in Descending Order Using Comparator
Last Updated: 27 January 2021
The Vector class implements a growable array of objects. Vectors basically fall in legacy classes but now it is fully compatible with collections. It is found in java.util...
read more
Java
Technical Scripter
Java Programs
Picked
Java-Vector
Java-Comparator
Technical Scripter 2020
How to Fix java.lang.ClassCastException in TreeSet By Using Custom Comparator in Java?
Last Updated: 07 January 2021
This error is thrown by TreeSet because TreeSet is used to store elements in sorted order and if the specified element cannot be compared with the elements currently in th...
read more
Java
Technical Scripter
Java-lang package
Java Programs
Picked
Java-Comparator
Technical Scripter 2020
Java Program to Sort Keys in TreeMap by using Comparator with User Defined Objects
Last Updated: 04 October 2021
The TreeMap in Java is used to implement Map interface and NavigableMap along with the AbstractMap Class. The map is sorted according to the natural ordering of its keys, ...
read more
Java
Java Programs
java-TreeMap
Picked
Java-Comparator
Creating TreeSet with Comparator by User Define Objects in Java
Last Updated: 17 May 2021
TreeSet is the implementation class of Set Interface. It follows a natural sorting order or you can customize it using a comparator and it also does not allow duplicates.S...
read more
Java
Java Programs
java-treeset
Picked
Java-Comparator
Sort ArrayList in Descending Order Using Comparator in Java
Last Updated: 13 July 2022
A comparator is an interface that is used to rearrange the ArrayList in a sorted manner. A comparator is used to sort an ArrayList of User-defined objects. In java, a Comp...
read more
Java
Technical Scripter
Java Programs
Java-ArrayList
Picked
Java-Comparator
Technical Scripter 2020
Sort an Array of Version Numbers
Last Updated: 26 December 2023
Given an array of strings arr[], consisting of N strings each representing dot separated numbers in the form of software versions.Input: arr[] = {"1.1.2", "0.9.1", "1.1.0"...
read more
Arrays
Strings
Google
Interview Experiences
Algorithms
Sorting
Mathematical
interview-preparation
Java-Comparator
DSA
Experiences
Sort the given IP addresses in ascending order
Last Updated: 12 April 2023
Given an array arr[] of IP Addresses where each element is a IPv4 Address, the task is to sort the given IP addresses in increasing order.Examples:Input: arr[] = {'126.255...
read more
Arrays
Sorting
IP Addressing
Java-Comparator
DSA
Comparator comparingDouble() method in Java with examples
Last Updated: 29 April 2019
The comparingDouble(java.util.function.ToDoubleFunction) method of Comparator Interface in Java accepts a function as parameter that extracts an double sort key from a typ...
read more
Java
Java - util package
Java-Functions
Java-Comparator
Comparator thenComparingDouble() method in Java with examples
Last Updated: 29 April 2019
The thenComparingDouble(java.util.function.ToDoubleFunction) method of Comparator Interface in Java returns a lexicographic-order comparator with a function that extracts ...
read more
Java
Java - util package
Java-Functions
Java-Comparator
Comparator thenComparingLong() method in Java with examples
Last Updated: 29 April 2019
The thenComparingLong(java.util.function.ToLongFunction) method of Comparator Interface in Java returns a lexicographic-order comparator with a function that extracts a Lo...
read more
Java
Java - util package
Java-Functions
Java-Comparator
Comparator comparingLong() method in Java with examples
Last Updated: 29 April 2019
The comparingLong(java.util.function.ToLongFunction) method of Comparator Interface in Java accepts a function as parameter that extracts an long sort key from a type T, a...
read more
Java
Java - util package
Java-Functions
Java-Comparator
Comparator naturalOrder() method in Java with examples
Last Updated: 29 April 2019
The naturalOrder() method of Comparator Interface in Java returns a comparator that use to compare Comparable objects in natural order. The returned comparator by this met...
read more
Java
Java - util package
Java-Functions
Java-Comparator
Comparator reversed() method in Java with examples
Last Updated: 05 February 2021
The reversed() method of Comparator Interface in Java returns a comparator that imposes the reverse ordering of this comparator. If you use sort method of the array and pa...
read more
Java
Java - util package
Java-Functions
Java-Comparator
1
2
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our
Cookie Policy
&
Privacy Policy
Got It !