String#split with a "dot" 📎
String packages[] = "com.airhacks".split(".");
assertThat(packages.length, is(0));
The split
method parameter is a regular expression, and
"dot" is Any character (may or may not match line terminators)
Escaping the dot solves the "problem":
String packages[] = "com.airhacks".split("\\.");
assertThat(packages.length, is(2));