以 "ies" 或非标准 "s" 复数形式结尾的复数形式的对象列表的 Java 命名约定是什么?
What is the Java naming convention for list of objects which have plural forms ending with "ies" or non-standard "s" plural forms?
我找不到 Java 的任何命名约定,其中涵盖了不遵循标准“s”复数形式的单词的用法。
//Given a list of biologies, what should the getter method be?
private List<Biology> biologies;
public Biology getBiology();
public List<Biology> getBiologies();
当复数形式差异很大时,约定是什么?
//Given a list of octopi, what should the getter method be?
private List<Octopus> octopi;
public Octopus getOctopus();
public List<Octopus> getOctopi();
这是意见的边缘,但我称之为“最佳实践”并说:
使用复数并正确拼写。
正如您应该正确拼写 all variables/fields(如果清楚,可以接受长术语的缩写,例如 min
、max
等).
不权威,但Intellij auto-generates正确拼写了复数,例如:
List<Company> x; // "companies" will be auto-suggested if you rename "x"
我找不到 Java 的任何命名约定,其中涵盖了不遵循标准“s”复数形式的单词的用法。
//Given a list of biologies, what should the getter method be?
private List<Biology> biologies;
public Biology getBiology();
public List<Biology> getBiologies();
当复数形式差异很大时,约定是什么?
//Given a list of octopi, what should the getter method be?
private List<Octopus> octopi;
public Octopus getOctopus();
public List<Octopus> getOctopi();
这是意见的边缘,但我称之为“最佳实践”并说:
使用复数并正确拼写。
正如您应该正确拼写 all variables/fields(如果清楚,可以接受长术语的缩写,例如 min
、max
等).
不权威,但Intellij auto-generates正确拼写了复数,例如:
List<Company> x; // "companies" will be auto-suggested if you rename "x"