Skip to content
Courses
DSA to Development
Get IBM Certification
Newly Launched!
Master Django Framework
Become AWS Certified
For Working Professionals
Interview 101: DSA & System Design
Data Science Training Program
JAVA Backend Development (Live)
DevOps Engineering (LIVE)
Data Structures & Algorithms in Python
For Students
Placement Preparation Course
Data Science (Live)
Data Structure & Algorithm-Self Paced (C++/JAVA)
Master Competitive Programming (Live)
Full Stack Development with React & Node JS (Live)
Full Stack Development
Data Science Program
All Courses
Tutorials
Data Structures & Algorithms
ML & Data Science
Interview Corner
Programming Languages
Web Development
CS Subjects
DevOps And Linux
School Learning
Practice
Build your AI Agent
GfG 160
Problem of the Day
Practice Coding Problems
GfG SDE Sheet
Contests
Accenture Hackathon (Ending Soon!)
GfG Weekly [Rated Contest]
Job-A-Thon Hiring Challenge
All Contests and Events
DSA
Practice Problems
Python
C
C++
Java
Courses
Machine Learning
DevOps
Web Development
System Design
Aptitude
Projects
Sign In
▲
Similar Topics
DSA
22.3k+ articles
Java
10.1k+ articles
Mathematical
7.7k+ articles
Arrays
6.4k+ articles
Difference Between
4.2k+ articles
Java-Functions
4.1k+ articles
Java Programs
2.1k+ articles
Sorting
1.7k+ articles
Java - util package
1.5k+ articles
Java-Comparable
10 articles
Java-Comparator
21 posts
Popular Articles
Recent Articles
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 collec
...read more
Java
Technical Scripter
Java Programs
Picked
Java-Vector
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
...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 a
...read more
Java
Java Programs
java-treeset
Picked
Java-Comparator
Similar Topics
DSA
22.3k+ articles
Java
10.1k+ articles
Mathematical
7.7k+ articles
Arrays
6.4k+ articles
Difference Between
4.2k+ articles
Java-Functions
4.1k+ articles
Java Programs
2.1k+ articles
Sorting
1.7k+ articles
Java - util package
1.5k+ articles
Java-Comparable
10+ articles
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-d
...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
...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.Ex
...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 extract
...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
...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
...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
...read more
Java
Java - util package
Java-Functions
Java-Comparator
Comparator reverseOrder() method in Java with examples
Last Updated: 12 April 2023
The reverseOrder() method of Comparator Interface in Java returns a comparator that use to compare Comparable objects in reverse of natural
...read more
Java
Java - util package
Java-Functions
Java-Comparator
Comparator comparingInt() in Java with examples
Last Updated: 29 April 2019
The comparingInt(java.util.function.ToIntFunction) method accepts a function as parameter that extracts an int sort key from a type T, and r
...read more
Java
Java - util package
Java-Functions
Java-Comparator
Comparator nullsFirst() method in Java with examples
Last Updated: 29 April 2019
The nullsFirst(java.util.Comparator) method returns comparator that is a null-friendly comparator and considers null values to be less than
...read more
Java
Java - util package
Java-Functions
Java-Comparator
Comparator nullsLast() method in Java with examples
Last Updated: 29 April 2019
The nullsLast (java.util.Comparator) method returns comparator that is a null-friendly comparator and considers null values greater than non
...read more
Java
Java - util package
Java-Functions
Java-Comparator
Java Comparable vs Comparator
Last Updated: 16 April 2025
In Java, both Comparable and Comparator are used for sorting objects. The main difference between Comparable and Comparator is:Comparable: I
...read more
Java
Difference Between
Java-Comparator
Java-Comparable
1
2
>>
Last
1
2
>>
Last
1
2
>>
Last
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 !