Prefer using Splitter to String.split

String.split(String) has surprising behaviour [1]:

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

More examples:

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

Tests and classes that are used by the GWT UI are not adapted.

[1] http://konigsberg.blogspot.com/2009/11/final-thoughts-java-puzzler-splitting.html

Change-Id: Ib9534727a9fe1840eecb86e4141ca3fe9d997936
Signed-off-by: Edwin Kempin <ekempin@google.com>
1 file changed
tree: d778ed9b644ec26b43f2a0e2608cc3e2a957fc38
  1. .gitignore
  2. BUILD
  3. LICENSE
  4. src/