Class StringValueUtils.WhitespaceTokenizer

  • All Implemented Interfaces:
    Serializable
    Enclosing class:
    StringValueUtils

    public static final class StringValueUtils.WhitespaceTokenizer
    extends Object
    implements Serializable
    A tokenizer for string values that uses whitespace characters as token delimiters. The tokenizer is designed to have a resettable state and operate on mutable objects, sparing object allocation and garbage collection overhead.
    See Also:
    Serialized Form
    • Constructor Detail

      • WhitespaceTokenizer

        public WhitespaceTokenizer()
        Creates a new tokenizer with an undefined internal state.
    • Method Detail

      • setStringToTokenize

        public void setStringToTokenize​(StringValue string)
        Sets the string to be tokenized and resets the state of the tokenizer.
        Parameters:
        string - The string value to be tokenized.
      • next

        public boolean next​(StringValue target)
        Gets the next token from the string. If another token is available, the token is stored in the given target StringValue object.
        Parameters:
        target - The StringValue object to store the next token in.
        Returns:
        True, if there was another token, false if not.