Java String.split() accepts a regular expression, not a literal delimiter. Passing "." therefore treats every character as a delimiter because the dot means “any character,” rather than splitting java.util.concurrent at its dots. section 6.5
Escape literal delimiters
String[] parts = javaPackage.split("\\\\."); Alternatively, use Pattern.quote(".") when the delimiter should always be literal. Java processes the string-literal escape first, so the backslash needed by the regular expression must itself be escaped. section 6.5
Account for split() limits and choose an appropriate literal-splitting alternative:
- The default limit of zero removes trailing empty strings; pass -1 when trailing empty matches must be preserved. section 6.5
- Use a positive limit to stop splitting after a specified number of parts. section 6.5
- For literal delimiters, consider Pattern.compile(delimiter, Pattern.LITERAL), Guava Splitter, or Apache Commons StringUtils.splitByWholeSeparator. section 6.5










