Class CountsOfThingsStringJoiner


  • public class CountsOfThingsStringJoiner
    extends Object
    A StringJoiner variant that specifically optimizes creating comma-separated lists of counts of things (in english language).
    Author:
    Rene Schneider - initial API and implementation
    • Constructor Detail

      • CountsOfThingsStringJoiner

        public CountsOfThingsStringJoiner()
        Constructor.
      • CountsOfThingsStringJoiner

        public CountsOfThingsStringJoiner​(boolean anAddZeroCountsFlag)
        Constructor.
        Parameters:
        anAddZeroCountsFlag - whether to add anything at all for counts of 0 objects
    • Method Detail

      • add

        public void add​(long aCount,
                        String aSingularObjectName,
                        String aPluralObjectName)
        Adds the specified count of things.
        Parameters:
        aCount - the count to add
        aSingularObjectName - the object to be counted in its singular form
        aPluralObjectName - the object to be counted in plural form
      • add

        public void add​(long aCount,
                        String aSingularObjectName,
                        String aPluralObjectName,
                        Object aDataObject)
        Adds the specified count of things.
        Parameters:
        aCount - the count to add
        aSingularObjectName - the object to be counted in its singular form
        aPluralObjectName - the object to be counted in plural form
        aDataObject - Optional data object to associate with this segment