Java-Netbeans上的Error Collections.sort
我运行的是Netbeans 8.0.2,我不知道我不能使用Collections.sort(),我有这个错误Java-Netbeans上的Error Collections.sort,java,arraylist,netbeans,Java,Arraylist,Netbeans,我运行的是Netbeans 8.0.2,我不知道我不能使用Collections.sort(),我有这个错误 The type of Sort(Comparator<? super E> is erroneous where E is a type-variable : E extends object declared in class ArrayList 排序类型(ComparatorCollections.Sort(myArrayList);与myArrayList.Sort
The type of Sort(Comparator<? super E> is erroneous where E is a type-variable : E extends object declared in class ArrayList
排序类型(ComparatorCollections.Sort(myArrayList);
与myArrayList.Sort();
不同。代码是什么?很可能是代码中的错误,因为Netbeans本身只是一个IDE。ArrayList不是一个集合吗?我测试了这两种方法,排序成功了。@Paul这是我代码的一小部分=)@我指的是你调用Collections.sort()
的代码。
private void chargeData(String fileName) {
base.ArticleDao.listeArticles = base.ArticleDao.getListeArticles(fileName);
base.ArticleDao.listeArticles.sort(null);
//Collections.sort(listeArticles);
for (int i = 0; i < base.ArticleDao.listeArticles.size(); i++) {
lstArticles.add(base.ArticleDao.listeArticles.get(i).toString());
}
}//chargeData