39

Is there any way to sort the properties of an object by their names when using the Java debugger?

For example, I'm seeing this:

intellij debugging view

And I'd like to see this:

debugging ordered

Andrew Tobilko
  • 48,120
  • 14
  • 91
  • 142
Thoomas
  • 2,150
  • 2
  • 19
  • 33
  • 1
    there is a plugin provided by intellj, take a look at the following link https://plugins.jetbrains.com/plugin/4055-property-sorter – Basil Battikhi Jul 25 '18 at 06:50
  • 3
    This plugin sorts the properties of a `.properties` file. In my case, I'm looking for a solution to sort the properties/fields of a POJO. – Thoomas Jul 25 '18 at 06:54

2 Answers2

52

There is no separate option for sorting only fields alphabetically, but IDEA provides the feature "Sort Values Alphabetically" in the debug tool window.

It sorts both variables and their members in alphabetical order.

Before: enter image description here

After: enter image description here

Andrew Tobilko
  • 48,120
  • 14
  • 91
  • 142
7
  • Ultimate 2019.3
  • Open services
  • Click on the left on the 'wheel' settings.
  • Activate sort values alphabetically.

2 screen dumps to help the reader to find the configuration. enter image description here

enter image description here

Rudy Vissers
  • 5,267
  • 4
  • 35
  • 37