Eclipse sorts import statements within the import groups using lexicographical order, which is case sensitive.
For example :
import com.company.something.DBException;
import com.company.something.DatabaseHandler;
Is it possible to change that automatic sorting to be case insensitive. In the above example, I'd like the order to be :
import com.company.something.DatabaseHandler;
import com.company.something.DBException;
I found a way to do it: first, there in the Window > Preferences > Java > Code Style > Organize Imports
option, delete all the entries that indicate specific packages order:
And then enter one single entry with only a *
character.
Apparently, this indicates you don't want to specify any custom order and then Eclipse decides the order method, which by default seems to be lexicographical.
That's it. Next time you execute the Source > Organize Imports
command or the CTRL + SIFT + O
shortcut, the order will be lexicographical.
🤓🤯😎
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With