private boolean in(List<String> cycle, Set<List<String>> cycles) {
            List<String> superCycle = new ArrayList<>(cycle);
            superCycle.remove(superCycle.size() - 1);
            superCycle.addAll(cycle);
            for (List<String> foundCycle: cycles) {
                if (foundCycle.size() == cycle.size() && Collections.indexOfSubList(superCycle, foundCycle) != -1)
                    return true;
            }
            return false;
        }
This class maintains some data structures to simplify lookup of partition movements among consumers. At each point of
time during a partition rebalance it keeps track of partition movements corresponding to each topic, and also possible
movement (in form a <code>ConsumerPair</code> object) for each partition.
clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractStickyAssignor.java