List<Question> questions = new ArrayList<Question>();
questions.addAll(getAllQuestions()); //returns a set of Questions
Collections.sort(questions, new BeanComparator("questionId")); //org.apache.commons.beanutils.BeanComparator
在Java 1.5中,上述代码可以正常工作,但 'new BeanComparator("questionId")' 会产生未经检查的警告。我不喜欢警告。有没有办法为 BeanComparator 提供类型,或者必须使用 @SuppressWarnings("unchecked")
?
ORDER BY id
操作? - BalusC