Eclipse organize methods in alphabetical order

孤人 提交于 2019-11-28 08:01:29

If you just want to view your class members in sorted order without modifying the code then you can click on the A/Z icon on the outline view, as others have pointed out. Alternatively, you may wish to sort the class members in the code itself, in which case you should right click your source or source file name to get the context sensitive menu, then select Source(Alt-Shift-S), Sort Members.

It will pop up a dialog box allowing you to customize the sort, choose your desired options and click ok.

Press the Sort button in the Outline view. It has A, Z, and an arrow in it.

I wouldn't modify the Java source if I were you. If you're using an IDE such as Eclipse, then this adds no benefit, and there are a few costs, including:

  1. If the code already is checked in to source control, then resorting it can break the history
  2. I've never heard of a group with a coding convention of sorting methods alphabetically
Pieter De Bie

You can actually sort members of your class in your code with eclipse, in my opinion this improves readability but should be used with caution.

select the class, Source > Sort Members

Thanks to marcggs' answer.

You can use the alphabetic sort in the overview window for this.

icon
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!