1 2 23 package com.geinuke.util.collection; 24 25 import java.util.Comparator ; 26 27 import com.geinuke.vo.TopicVO; 28 29 30 public class ForumTopicComparator implements Comparator { 31 32 public static int ASC=0; 33 public static int DESC=0; 34 protected int ord=-1; 35 36 public ForumTopicComparator(){ 37 super(); 38 this.ord=DESC; 39 } 40 41 public ForumTopicComparator(int o){ 42 super(); 43 this.ord=o; 44 } 45 46 public int compare(Object first, Object second) { 47 TopicVO f=(TopicVO)first; 48 TopicVO s=(TopicVO)second; 49 if(this.ord==DESC) 50 return (new Long (s.getLastModTime())).compareTo( new Long (f.getLastModTime()) ); 51 else 52 return (new Long (f.getLastModTime())).compareTo( new Long (s.getLastModTime()) ); 53 } 54 55 56 } 57 58 | Popular Tags |