list.stream().collect(Collectors.groupingBy(ClassEntity::getGrade));
list.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getProfessionId() + ";" + o.getGrade()))), ArrayList::new));
List classNameList = new ArrayList(new HashSet(list));