java - 如何在其成员排序的intellij中生成java的hashcode方法?

标签 java eclipse sorting intellij-idea hashcode

我想在 Intellij 中生成 java equals() 和 hashcode() 方法。我希望它以 eclipse 生成的方式生成。我创建了一个自定义模板来执行此操作。但是,在 intellij 生成的 hashcode 方法中,成员是按照它们列出的顺序排列的,而不是按字母顺序排列的。但是eclipse在生成equals和hashcode方法时是按字母顺序排序的。我需要在 Intellij 中实现这一点。我找不到要使用的任何排序功能。任何帮助或指示将不胜感激。 谢谢

最佳答案

此请求已提交给 IntelliJ IDEA,它是 declined with the following comment :

We assume that you have ordered your members in a meaningful order within the file, and that preserving this order would be more meaningful than alphabetic sorting.

关于java - 如何在其成员排序的intellij中生成java的hashcode方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46830499/

相关文章:

java - ObjectInputStream readInt() 不起作用

java - 在创建线程后将值从 Activity 传递到线程

java - 如何缩放从 PNG 加载的透明 org.eclipse.swt.graphics.Image; java

java - pull 后,Eclipse 中的 Git 项目从工作区消失

php - 按范围 10 x 10 对数组进行排序

java - 带有 FlowLayout 的 JPanel 未出现

java - 在验证文件时是否应该使用异常来产生自定义错误?

eclipse - 移动Grails项目以使用greclipse

templates - D 模板 : Sort a list of types

php - 为什么 natsort(或 natcasesort)不在这里工作?