private List<TopicPartition> getUnassignedPartitions(List<TopicPartition> sortedAssignedPartitions) {
            if (sortedAssignedPartitions.isEmpty()) {
                return sortedAllPartitions;
            }

            List<TopicPartition> unassignedPartitions = new ArrayList<>();

            Collections.sort(sortedAssignedPartitions, new PartitionComparator(topic2AllPotentialConsumers));

            boolean shouldAddDirectly = false;
            Iterator<TopicPartition> sortedAssignedPartitionsIter = sortedAssignedPartitions.iterator();
            TopicPartition nextAssignedPartition = sortedAssignedPartitionsIter.next();

            for (TopicPartition topicPartition : sortedAllPartitions) {
                if (shouldAddDirectly || !nextAssignedPartition.equals(topicPartition)) {
                    unassignedPartitions.add(topicPartition);
                } else {
                    // this partition is in assignedPartitions, don't add to unassignedPartitions, just get next assigned partition
                    if (sortedAssignedPartitionsIter.hasNext()) {
                        nextAssignedPartition = sortedAssignedPartitionsIter.next();
                    } else {
                        // add the remaining directly since there is no more sortedAssignedPartitions
                        shouldAddDirectly = true;
                    }
                }
            }
            return unassignedPartitions;
        }
get the unassigned partition list by computing the difference set of the sortedPartitions(all partitions)
and sortedAssignedPartitions. If no assigned partitions, we'll just return all sorted topic partitions.

We loop the sortedPartition, and compare the ith element in sortedAssignedPartitions(i start from 0):
  - if not equal to the ith element, add to unassignedPartitions
  - if equal to the ith element, get next element from sortedAssignedPartitions

@param sortedAssignedPartitions:     sorted partitions, all are included in the sortedPartitions
@return                              partitions that aren't assigned to any current consumer
clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractStickyAssignor.java