Posts

Showing posts with the label sorting

sorting a List containing Object[] elements

Problem Statement:  How can we  sort a List containing Object[] elements? The Solution: Ever wondered how to sort a list full of Object[]? The answer is to use a Comparator I have used an anonymous class which implements compare method to sort the List of Object[] package  example.collections; import  java.util.ArrayList; import  java.util.Collections; import  java.util.Comparator; import  java.util.List; public   class  Sorting {         public   static   void  main(String[] args) {               List<Object[]> list =  new  ArrayList<Object[]>();                             list.add( new  Object[]{123,  "abc" , 212})...