public RackAwareOptimizationParams forStatefulTasks() {
            final SortedSet<TaskId> tasks = applicationState.allTasks().values()
                .stream()
                .filter(TaskInfo::isStateful)
                .map(TaskInfo::id)
                .collect(Collectors.toCollection(TreeSet::new));
            return forTasks(tasks);
        }
Return a new config object with the tasksToOptimize set to all stateful tasks in the given ApplicationState
streams/src/main/java/org/apache/kafka/streams/processor/assignment/TaskAssignmentUtils.java