【发布时间】:2010-06-27 03:48:59
【问题描述】:
我正在使用 Guava-05-snapshot 和 Sun 的 JDK 1.6 代码在执行这个 sn-p 时崩溃了:
List<String> badpasswords = Lists.newArrayList( Password.badWords);
Collections.sort(badpasswords);
ImmutableList<String> tmp = ImmutableList.copyOf(badpasswords);
特别是在 ImmutableList.copyOf() 调用上。 该代码使用旧的 Google-Collections 代码已经运行了几个月。
java.lang.NoSuchMethodError: com.google.common.collect.ImmutableList.copyOf(Ljava/util/Collection;)Lcom/google/common/collect/ImmutableList;
Password.badWords 是ImmutableSet<String>,可写数组的创建和排序工作完美。但尝试将 Array 转换为 ImmutableList 失败。
【问题讨论】:
-
你后面的问题回答了同样的问题:stackoverflow.com/questions/3126276/…
-
顺便说一句,您应该支持/接受有用的答案。