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
Under Java 1.5, the above works fine except that the 'new BeanComparator("questionId")' generates an unchecked warning. I do not like warnings. Is there a way I can provide the BeanComparator a type, or do I have to use @SuppressWarnings("unchecked")
?
Options are:
BeanComparator
to implement Comparator<Question>
. This is not a real option here, given it is a well-known external library class. People ain't going to let you do it.BeanComparator
as above, giving it a different FQN.BeanComparator
with a class that implements Comparator<Question>
.questions
to List<?>
.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With