---
title: "Discussion on \"Sorting a List of Objects in Java: A Configurable Approach with Comparator and Enums\" | Hashnode"
description: "Discussion on \"Sorting a List of Objects in Java: A Configurable Approach with Comparator and Enums\". In this article, I have shown a way to sort a list of Employee object based on a specific field and the sorting order using Comparator. The code snippet shows that the sorting criteria are configurable, eliminating the need to add an if/else block wh..."
url: "https://hashnode.com/posts/sorting-a-list-of-objects-in-java-a-configurable-approach-with-comparator-and-enums/65cb0c133cceb1e38bb72590"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Sorting a List of Objects in Java: A Configurable Approach with Comparator and Enums](https://alokdubey.hashnode.dev/sorting-a-list-of-objects-in-java-a-configurable-approach-with-comparator-and-enums?utm_source=hashnode&utm_medium=feed)

In this article, I have shown a way to sort a list of Employee object based on a specific field and the sorting order using Comparator. The code snippet shows that the sorting criteria are configurable, eliminating the need to add an if/else block wh...

Feb 13, 2024 · 2 min read · alokdubey.hashnode.dev  
Read the article

-   [#java](https://hashnode.com/tag/java)
-   [#java-comparator](https://hashnode.com/tag/java-comparator)

## Written by

[Alok Dubey](https://hashnode.com/@alokdubey)

@alokdubey

  
[View profile](https://hashnode.com/@alokdubey)

Java Enthusiast

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
