Loading
Sort ArrayList

Java Quick Notes

Refresh Your Java - Before Java Interview

We are Agile, believe in less Documentation - Only Quick notes (Java Interview Questions) of Java/J2ee Read more....


Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet

Go to SiteMap

Q)  What is the use of collections framework ? How do you Sort the ArrayList


Ans)

"Collections" could be used to perfome some operations like "sort()" , "synchronizedList()" etc., this uses "Command Design Pattern".

Collections.sort(questionVOList.getQuestionList(), new QuestionVOComparator());

 public static class QuestionVOComparator implements Comparator {
  @Override
     public int compare(Object o1, Object o2) {
         return ((QuestionVO)o1).getQuestionIdAsInt() - ((QuestionVO)o2).getQuestionIdAsInt();
     }
 }



Back to top

------------------------- We hope you got necessary Info On -----------------------------------------

Sort ArrayList


Sort ArrayList

-------------------------------------------------------------------------------------------------------



Face Book
Request for a Mock Interview/Training

Get a PDF

Face Book
Same look (Read) on any device, this is Ads free