Search code examples
javaforeachnaming

Java naming convention for a collection of items whose singular and plural are the same


I want to make a class called Series (containing episodes and information about this TV-series)

Then I have a

List<Series> series;

If I then want to loop over this collection I would want it to look like:

for (Series series : series) {}

How should I differentiate a single item of a series and a collection of series in a good way? Is it better to name it seriesCollection perhaps?


Solution

  • For tightly scoped variables, it is ok to just call it s.

    for (Series s : series) {}