Search code examples
javajavabeans

What is the Java naming convention for list of objects which have plural forms ending with "ies" or non-standard "s" plural forms?


I am unable to find any naming conventions for Java that covers the usage of words that does not follow the standard "s" plural form.

//Given a list of biologies, what should the getter method be?

private List<Biology> biologies;

public Biology getBiology();
public List<Biology> getBiologies();

What is the convention when the plural form is much different?

//Given a list of octopi, what should the getter method be?

private List<Octopus> octopi;

public Octopus getOctopus();
public List<Octopus> getOctopi();

Solution

  • This is on the edge of opinion, but I'm calling "best practice" and saying:

    Use plurals and spell them correctly.

    Just as you should spell all variables/fields correctly (abbrevations of long terms being acceptable if clear, eg min, max etc).


    Not authorative, but Intellij auto-generates correctly spelled plurals, eg:

    List<Company> x; // "companies" will be auto-suggested if you rename "x"