Open Wang-Kowah opened 5 years ago
@Override public int compareTo(Keyword o) { return this.tfidfvalue-o.tfidfvalue>0?-1:1; }
JDK.1.8下,当两个关键词的tfidfvalue相等时会抛出异常IllegalArgumentException: Comparison method violates its general contract! 按照以下方式改写即可:
@Override public int compareTo(Keyword o) { return this.tfidfvalue - o.tfidfvalue > 0 ? -1 : (this.tfidfvalue == o.tfidfvalue ? 0 : 1); }
JDK.1.8下,当两个关键词的tfidfvalue相等时会抛出异常IllegalArgumentException: Comparison method violates its general contract! 按照以下方式改写即可: