View Single Post
  #6 (permalink)  
Old 11-26-2009, 11:23 PM
Fubarable's Avatar
Fubarable Fubarable is offline
Moderator
 
Join Date: Jun 2008
Posts: 6,483
Rep Power: 8
Fubarable is on a distinguished road
Default
You either need to import java.util.Comparator or use fully qualified names, i.e.,
Code:
      java.util.Vector<Contact> book = new java.util.Vector<Contact>();

      java.util.Collections.sort(book, new java.util.Comparator<Contact>() {

         public int compare(Contact p1, Contact p2) {
            return p1.getsecondName().compareToIgnoreCase(p2.getsecondName());
         }
      });
__________________
When posting code, please use code tags so that your code is readable. To do this, place the tag [code] before your block of code and [/code] after your block of code.
How to use Code Tags
Reply With Quote