public int compareTo(Object obj, boolean caseInsensitive) { if (obj == null) { return -1; } if (caseInsensitive) ; // this is to avoid eclipse warning only. if (!(AssessmentQuestionShortVo.class.isAssignableFrom(obj.getClass()))) { throw new ClassCastException( "A AssessmentQuestionShortVo object cannot be compared an Object of type " + obj.getClass().getName()); } AssessmentQuestionShortVo compareObj = (AssessmentQuestionShortVo) obj; int retVal = 0; if (retVal == 0) { if (this.getSequence() == null && compareObj.getSequence() != null) return -1; if (this.getSequence() != null && compareObj.getSequence() == null) return 1; if (this.getSequence() != null && compareObj.getSequence() != null) retVal = this.getSequence().compareTo(compareObj.getSequence()); } return retVal; }