class="java" name="code"> Collections.sort(vos, new Comparator<GbsExtendedVO>() { public int compare(GbsExtendedVO arg0, GbsExtendedVO arg1) { String deptTypeSort0=arg0.getDeptTypeSort(); String deptTypeSort1=arg1.getDeptTypeSort(); int deptTypeSort = objCompare(deptTypeSort0, deptTypeSort1); return deptTypeSort; } private int objCompare(Object arg0, Object arg1) { if (arg0 == null && arg1 == null) { return 0; } else if (arg0 == null && arg1 != null) { return 1; } else if (arg0 != null && arg1 == null) { return -1; } return arg0.toString().compareTo(arg1.toString()); } });