Collections.sort(list, new Comparator() { @Override public int compare(Student o1, Student o2) { int result = 0; if (o1.getExta().equals("200")) { result = -1; } if (o2.getExta().equals("200")) { result = 1; } if (result != 0) return result; if (o1.getIsPriority() == 1) { result = -1; } if (o2.getIsPriority() == 1) { result = 1; } if (result != 0) return result; result = o1.getSort() - o2.getSort(); if (result != 0) return result; result = o2.getRating() - o1.getRating(); if (result != 0) return result; result = o2.getTiming() - o1.getTiming(); return result; } });