1 package org.roller.pojos; 2 3 import java.io.Serializable ; 4 import java.util.Comparator ; 5 6 public class BookmarkComparator implements Comparator , Serializable 7 { 8 static final long serialVersionUID = 4009699640952161148L; 9 10 public int compare(Object val1, Object val2) 11 throws ClassCastException 12 { 13 BookmarkData bd1 = (BookmarkData)val1; 14 BookmarkData bd2 = (BookmarkData)val2; 15 int priority1 = bd1.getPriority().intValue(); 16 int priority2 = bd2.getPriority().intValue(); 17 18 if (priority1 > priority2) 19 { 20 return 1; 21 } 22 else if (priority1 < priority2) 23 { 24 return -1; 25 } 26 27 return bd1.getName().compareTo(bd2.getName()); 30 31 } 32 33 } 34 | Popular Tags |