I'm trying to use com.google.common.base.Splitter as follows
Iterable<String> segs = Splitter.on("/").split("one/two/three/four/five");
for (String seg : segs) {
System.out.println(seg);
}
However, I'm seeing the following exception:
Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Platform.precomputeCharMatcher(Lcom/google/common/base/CharMatcher;)Lcom/google/common/base/CharMatcher;
at com.google.common.base.CharMatcher.precomputed(CharMatcher.java:664)
at com.google.common.base.CharMatcher.<clinit>(CharMatcher.java:71)
at com.google.common.base.Splitter.<init>(Splitter.java:107)
at com.google.common.base.Splitter.on(Splitter.java:171)
at Test.main(Test.java:30)
Does anyone have any idea what I'm doing wrong here?
I encountered the same problem. It turned out that I used a older version of guava. Go to this website:https://code.google.com/p/guava-libraries/, and download a newer version.
By the way,google-collections was renamed to Guava.