Class HCollector.StringJoinCollector

  • Enclosing class:
    HCollector

    public static class HCollector.StringJoinCollector
    extends Object
    • Field Detail

      • prefix

        @NonNull
        protected final @NonNull CharSequence prefix
        Prefix to be used before any elements.
      • separatorNormal

        @NonNull
        protected final @NonNull CharSequence separatorNormal
        Normal separator, to be used between all pairs of elements, except the last two.
      • separatorLast

        @NonNull
        protected final @NonNull CharSequence separatorLast
        Last separator, to be used between the final two elements.
      • suffix

        @NonNull
        protected final @NonNull CharSequence suffix
        Suffix to be used after all elements.
      • builder

        protected StringBuilder builder
        The current set of elements, the prefix and the separators. The suffix is never added to this builder, nor is the last separator.
      • lastSeparatorIndex

        protected int lastSeparatorIndex
        The index in builder of the most recently appended separator or -1 if none has been appended.
    • Method Detail

      • getPrefix

        @NonNull
        protected @NonNull CharSequence getPrefix()
        Prefix to be used before any elements.
        Returns:
        The prefix to be used before any elements.
      • getSeparatorNormal

        @NonNull
        protected @NonNull CharSequence getSeparatorNormal()
        Normal separator, to be used between all pairs of elements, except the last two.
        Returns:
        The normal separator, to be used between all pairs of elements, except the last two.
      • getSeparatorLast

        @NonNull
        protected @NonNull CharSequence getSeparatorLast()
        Last separator, to be used between the final two elements.
        Returns:
        The last separator, to be used between the final two elements.
      • getSuffix

        @NonNull
        protected @NonNull CharSequence getSuffix()
        Suffix to be used after all elements.
        Returns:
        The suffix to be used after all elements.
      • getBuilder

        protected StringBuilder getBuilder()
        The current set of elements, the prefix and the separators. The suffix is never added to this builder, nor is the last separator.
        Returns:
        The current working result.
      • getLastSeparatorIndex

        protected int getLastSeparatorIndex()
        The index in builder of the most recently appended separator or -1 if none has been appended.
        Returns:
        The index in getBuilder() of the most recently appended separator or -1 if none has been appended.
      • setBuilder

        protected void setBuilder​(StringBuilder builder)
        The current set of elements, the prefix and the separators. The suffix is never added to this builder, nor is the last separator.
        Parameters:
        builder - The new working result to replace the current one completely.
      • setLastSeparatorIndex

        protected void setLastSeparatorIndex​(int lastSeparatorIndex)
        The index in builder of the most recently appended separator or -1 if none has been appended.
        Parameters:
        lastSeparatorIndex - The new index value.