code: public static List<RebalanceTaskInfo> filterTaskPlanWithStores(List<RebalanceTaskInfo> existingPlanList,
                                                                     List<StoreDefinition> storeDefs) {
          List<RebalanceTaskInfo> plans = Lists.newArrayList();
          List<String> storeNames = StoreDefinitionUtils.getStoreNames(storeDefs);
  
          for(RebalanceTaskInfo existingPlan: existingPlanList) {
              RebalanceTaskInfo info = RebalanceTaskInfo.create(existingPlan.toJsonString());
  
              // Filter the plans only for stores given
              HashMap<String, List<Integer>> storeToPartitions = info.getStoreToPartitionIds();
  
              HashMap<String, List<Integer>> newStoreToPartitions = Maps.newHashMap();
              for(String storeName: storeNames) {
                  if(storeToPartitions.containsKey(storeName))
                      newStoreToPartitions.put(storeName, storeToPartitions.get(storeName));
              }
              info.setStoreToPartitionList(newStoreToPartitions);
              plans.add(info);
          }
          return plans;
      }
docs: Given a list of partition plans and a set of stores, copies the store
  names to every individual plan and creates a new list
  
  @param existingPlanList Existing partition plan list
  @param storeDefs List of store names we are rebalancing
  @return List of updated partition plan