Determine the subset of {@link KeyGroupsStateHandle KeyGroupsStateHandles} with correct
key group index for the given subtask {@link KeyGroupRange}.

<p>This is publicly visible to be used in tests.
324186
public static List<KeyedStateHandle> getKeyedStateHandles(
		Collection<? extends KeyedStateHandle> keyedStateHandles,
		KeyGroupRange subtaskKeyGroupRange) {

		List<KeyedStateHandle> subtaskKeyedStateHandles = new ArrayList<>(keyedStateHandles.size());

		for (KeyedStateHandle keyedStateHandle : keyedStateHandles) {
			KeyedStateHandle intersectedKeyedStateHandle = keyedStateHandle.getIntersection(subtaskKeyGroupRange);

			if (intersectedKeyedStateHandle != null) {
				subtaskKeyedStateHandles.add(intersectedKeyedStateHandle);
			}
		}

		return subtaskKeyedStateHandles;
	}
806033
List<List<TaskId>> interleaveTasksByGroupId(final Collection<TaskId> taskIds, final int numberThreads) {
    final LinkedList<TaskId> sortedTasks = new LinkedList<>(taskIds);
    Collections.sort(sortedTasks);
    final List<List<TaskId>> taskIdsForConsumerAssignment = new ArrayList<>(numberThreads);
    for (int i = 0; i < numberThreads; i++) {
      taskIdsForConsumerAssignment.add(new ArrayList<>());
    }
    while (!sortedTasks.isEmpty()) {
      for (final List<TaskId> taskIdList : taskIdsForConsumerAssignment) {
        final TaskId taskId = sortedTasks.poll();
        if (taskId == null) {
          break;
        }
        taskIdList.add(taskId);
      }
    }
    return taskIdsForConsumerAssignment;
  }
388505
@Override
	public boolean containsKey(Object key) {
		return this.groupedMap.containsKey(DEFAULT_GROUP, Convert.toStr(key));
	}
382969
function getKeyframesSelectorsGroup() {
  let selectorsGroup = [];
  const selectorsGroupEnd = tokens[pos].selectorsGroupEnd;

  selectorsGroup.push(getKeyframesSelector());

  if (checkSC(pos) && tokens[pos].type !== TokenType.Newline) {
    selectorsGroup = selectorsGroup.concat(getSC());
  }

  while (pos < selectorsGroupEnd) {
    selectorsGroup = selectorsGroup.concat(
      getDelim(),
      getSC(),
      getSC(),
      getSC(),
      getKeyframesSelector()
    );

    if (checkSC(pos) && tokens[pos].type !== TokenType.Newline) {
      selectorsGroup = selectorsGroup.concat(getSC());
    }
  }

  return selectorsGroup;
}
758411
public void setInputSecurityGroups(java.util.Collection<InputSecurityGroup> inputSecurityGroups) {
        if (inputSecurityGroups == null) {
            this.inputSecurityGroups = null;
            return;
        }

        this.inputSecurityGroups = new java.util.ArrayList<InputSecurityGroup>(inputSecurityGroups);
    }
1313955
@SuppressWarnings("unchecked, rawtype")
	private GroupByStateNameResults groupByStateMode(List<List<OperatorStateHandle>> previousParallelSubtaskStates) {

		//Reorganize: group by (State Name -> StreamStateHandle + StateMetaInfo)
		EnumMap<OperatorStateHandle.Mode,
				Map<String, List<Tuple2<StreamStateHandle, OperatorStateHandle.StateMetaInfo>>>> nameToStateByMode =
				new EnumMap<>(OperatorStateHandle.Mode.class);

		for (OperatorStateHandle.Mode mode : OperatorStateHandle.Mode.values()) {

			nameToStateByMode.put(
					mode,
					new HashMap<>());
		}

		for (List<OperatorStateHandle> previousParallelSubtaskState : previousParallelSubtaskStates) {
			for (OperatorStateHandle operatorStateHandle : previousParallelSubtaskState) {

				if (operatorStateHandle == null) {
					continue;
				}

				final Set<Map.Entry<String, OperatorStateHandle.StateMetaInfo>> partitionOffsetEntries =
					operatorStateHandle.getStateNameToPartitionOffsets().entrySet();

				for (Map.Entry<String, OperatorStateHandle.StateMetaInfo> e : partitionOffsetEntries) {
					OperatorStateHandle.StateMetaInfo metaInfo = e.getValue();

					Map<String, List<Tuple2<StreamStateHandle, OperatorStateHandle.StateMetaInfo>>> nameToState =
						nameToStateByMode.get(metaInfo.getDistributionMode());

					List<Tuple2<StreamStateHandle, OperatorStateHandle.StateMetaInfo>> stateLocations =
						nameToState.computeIfAbsent(
							e.getKey(),
							k -> new ArrayList<>(previousParallelSubtaskStates.size() * partitionOffsetEntries.size()));

					stateLocations.add(Tuple2.of(operatorStateHandle.getDelegateStateHandle(), e.getValue()));
				}
			}
		}

		return new GroupByStateNameResults(nameToStateByMode);
	}
444567
private Tuple2<List<KeyedStateHandle>, List<KeyedStateHandle>> reAssignSubKeyedStates(
			OperatorState operatorState,
			List<KeyGroupRange> keyGroupPartitions,
			int subTaskIndex,
			int newParallelism,
			int oldParallelism) {

		List<KeyedStateHandle> subManagedKeyedState;
		List<KeyedStateHandle> subRawKeyedState;

		if (newParallelism == oldParallelism) {
			if (operatorState.getState(subTaskIndex) != null) {
				subManagedKeyedState = operatorState.getState(subTaskIndex).getManagedKeyedState().asList();
				subRawKeyedState = operatorState.getState(subTaskIndex).getRawKeyedState().asList();
			} else {
				subManagedKeyedState = Collections.emptyList();
				subRawKeyedState = Collections.emptyList();
			}
		} else {
			subManagedKeyedState = getManagedKeyedStateHandles(operatorState, keyGroupPartitions.get(subTaskIndex));
			subRawKeyedState = getRawKeyedStateHandles(operatorState, keyGroupPartitions.get(subTaskIndex));
		}

		if (subManagedKeyedState.isEmpty() && subRawKeyedState.isEmpty()) {
			return new Tuple2<>(Collections.emptyList(), Collections.emptyList());
		} else {
			return new Tuple2<>(subManagedKeyedState, subRawKeyedState);
		}
	}
279482
public static <T extends Key <T>> GroupMatcher <T> groupContains (final String compareTo)
  {
    return new GroupMatcher <> (compareTo, StringOperatorName.CONTAINS);
  }
1036338
public void setChartState(final List<Long> groupTargetCounts, final Long totalTargetsCount) {
        getState().setGroupTargetCounts(groupTargetCounts);
        getState().setTotalTargetCount(totalTargetsCount);
        markAsDirty();
    }
500005
private static <K, N, S> int countMappingsInKeyGroup(final Map<N, Map<K, S>> keyGroupMap) {
		int count = 0;
		for (Map<K, S> namespaceMap : keyGroupMap.values()) {
			count += namespaceMap.size();
		}

		return count;
	}
293601
private void doGroupCheck() {
        if (!hasTabs()) return;

        for (String groupName : getGroupNames()) {
            String tabName = getGroupedAttribtes(groupName).get(0).getTabName();
            for (PropertyBinding propBinding : getGroupedAttribtes(groupName)) {
                if (!tabName.equals(propBinding.getTabName())) {
                    throw new RuntimeException("FormItem " + propBinding.getJavaName() + " must be on the same tab with all members of its subgroup.");
                }
            }
        }
    }
423991
@SuppressWarnings("rawtypes")
	public static void incCounter(TaskInputOutputContext ctx, String groupName, Enum counter) {
		ctx.getCounter(groupName, counter.toString()).increment(1);
	}
1123954
private void sort(InstructionGroup group) {
        final InsnList instructions = method.instructions;
        Collections.sort(group.getNodes(), new Comparator<InstructionGraphNode>() {
            public int compare(InstructionGraphNode a, InstructionGraphNode b) {
                return Integer.valueOf(instructions.indexOf(a.getInstruction()))
                        .compareTo(instructions.indexOf(b.getInstruction()));
            }
        });
    }
112586
public static boolean checkKeyAgreement(Platform platform, byte[] aMsg, int keyPos,
			int keyCount) {
		if (keyCount != 4)
			return false;
		
		boolean result = (platform.getUtils().equals(KeyAgreementType.ECDH384.getType(), 0, aMsg, keyPos , 4)  &&
			    platform.getUtils().equals(KeyAgreementType.ECDH256.getType(), 0, aMsg, keyPos + 1 * 4, 4) &&
			    platform.getUtils().equals(KeyAgreementType.DH3K.getType(), 0, aMsg, keyPos + 2 * 4, 4) &&
			    platform.getUtils().equals(new byte[] { 'D', 'H', '2', 'k' }, 0, aMsg, keyPos + 3 * 4, 4));
		
		return result;
	}
550580
public List<KeyWithUuidDto> selectAllSiblingComponentKeysHavingOpenIssues(DbSession dbSession, String referenceBranchUuid, String currentBranchUuid) {
    return mapper(dbSession).selectAllSiblingComponentKeysHavingOpenIssues(referenceBranchUuid, currentBranchUuid);
  }
70098
private static boolean subsumedBy(BlocksGroup group1, BlocksGroup group2, int indexCorrection) {
    List<Block> list1 = group1.blocks;
    List<Block> list2 = group2.blocks;
    int i = 0;
    int j = 0;
    while (i < list1.size() && j < list2.size()) {
      Block block1 = list1.get(i);
      Block block2 = list2.get(j);
      int c = RESOURCE_ID_COMPARATOR.compare(block1.getResourceId(), block2.getResourceId());
      if (c != 0) {
        j++;
        continue;
      }
      c = block1.getIndexInFile() - indexCorrection - block2.getIndexInFile();
      if (c < 0) {
        // list1[i] < list2[j]
        break;
      }
      if (c != 0) {
        // list1[i] != list2[j]
        j++;
      }
      if (c == 0) {
        // list1[i] == list2[j]
        i++;
        j++;
      }
    }
    return i == list1.size();
  }
1025022
public int getNumberOfAvailableSlotsForGroup(AbstractID groupId) {
		synchronized (lock) {
			Map<ResourceID, List<SharedSlot>> available = availableSlotsPerJid.get(groupId);

			if (available != null) {
				Set<SharedSlot> set = new HashSet<SharedSlot>();

				for (List<SharedSlot> list : available.values()) {
					for (SharedSlot slot : list) {
						set.add(slot);
					}
				}

				return set.size();
			}
			else {
				// if no entry exists for a JobVertexID so far, then the vertex with that ID can
				// add a subtask into each shared slot of this group. Consequently, all
				// of them are available for that JobVertexID.
				return allSlots.size();
			}
		}
	}