Let\'s assume that we have a list of countries: List and each country has a reference to a list of its regions: List
List
You may map each country to number of regions and then reduce result using sum:
countries.stream() .map(c -> c.getRegions() == null ? 0 : c.getRegions().size()) .reduce(0, Integer::sum);