String.split(String) and Pattern.split(CharSequence) have surprising behaviour. For example, consider the following puzzler from https://konigsberg.blogspot.com/2009/11/final-thoughts-java-puzzler-splitting.html:

String[] nothing = "".split(":");
String[] bunchOfNothing = ":".split(":");

The result is [""] and []!

More examples:

input | input.split(":") | Pattern.compile(":").split(input) | Splitter.on(':').split(input) -------- | ------------------- | ----------------------------------- | ------------------------------- "" | [""] | [""] | [""] ":" | [] | [] | ["", ""] ":::" | [] | [] | ["", "", "", ""] "a:::" | ["a"] | ["a"] | ["a", "", "", ""] ":::b" | ["", "", "", "b"] | ["", "", "", "b"] | ["", "", "", "b"]

Prefer either:

TIP: if you use Splitter, consider extracting the instance to a static final field.