Skip to main content

Java Comparator Applications

Java Comparator is one of the favourite questions in Java Interviews.

This concept looks deceptively simple, and slight variations of this could be asked in the interviews.


1) Write an AlphaNumeric Comparator in Java that sorts the given strings in the human readable
    format.

 e.g., file1, file2, file 3, file4, file 10

Not like the typical comparator file1, file10




2) Chained Comparator which can be used to join Multiple Comparators


3) Given a List of Employee Objects group the Objects such that all the employees are grouped by
    Department and by Name.


4) Use Java 8 Style Comparators




Comments

Popular posts from this blog

Java Productivity tools

Here are the list of Java Productivity tools that help in simplifying the daily life of a developer. Eclipse as an IDE simplifies the development life cycle which has a lots of plugins to support different programming languages and frameworks. Some of useful Eclipse plugins are - Sonarlint that helps to do static code analysis and give suggestions as we go along the development life cycle. JDGUI - Is the Eclipse Plugin that supports the decompilation of the Java application within eclipse, this is very handy when debugging and need to look at the out of the box code from a framework/library. JUnit is the unit testing framework that supports Unit Testing of Java Applications. Mockito is the framework that supports the Mock Unit Testing of the Java Application.