Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse organize methods in alphabetical order

I have a large class that contains about 30 methods. Is it possible to automatically sort them in alphabetical order in eclipse? I was hoping to do this so they would be easier to find when java browsing or looking at the class outline window.

like image 977
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz Avatar asked Jul 01 '11 14:07

zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz


People also ask

How do you put a list in alphabetical order in Java?

Using the toCharArray() method Get the required string. Convert the given string to a character array using the toCharArray() method. Sort the obtained array using the sort() method of the Arrays class. Convert the sorted array to String by passing it to the constructor of the String array.


1 Answers

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.

like image 169
Perception Avatar answered Sep 20 '22 16:09

Perception