Naming of enums in Java: Singular or Plural?

friederbluemle picture friederbluemle · Apr 2, 2013 · Viewed 34k times · Source

Is there an "official" recommendation of how to name Java enums?

enum Protocol { HTTP, HTTPS, FTP }

or

enum Protocols { HTTP, HTTPS, FTP }

I know in the .Net world the recommendation is to use singular except for enums that represent bit flags. Just curious if there is something similar in Java.

A related question that seems to be .Net specific: Singular or plural for enumerations?

Answer

Avram Score picture Avram Score · Apr 2, 2013

Enums in Java (and probably enums in general) should be singular. The thinking is that you're not selecting multiple Protocols, but rather one Protocol of the possible choices in the list of values.

Note the absence of plurals: http://docs.oracle.com/javase/tutorial/java/javaOO/enum.html