public ArrayList<Integer> getContainerIndexesWithState(String state) {
    if (!(state.equals(State.STARTED.toString()) || state.equals(State.STOPPED.toString())
        || state.equals(State.STARTING.toString()) || state.equals(State.STOPPING.toString())
        || state.equals(State.UNKNOWN.toString()))) {
      throw new IllegalArgumentException(
          "State must be one of the 5 specified cargo state strings (stopped, started, starting, stopping, or unknown). State given was: "
              + state);
    }

    ArrayList<Integer> indexes = new ArrayList<>();
    for (int i = 0; i < numContainers(); i++) {
      if (getContainer(i).getState().toString().equals(state)) {
        indexes.add(i);
      }
    }
    return indexes;
  }
Get the positions of the containers with the given container state

@param state A string representing the Cargo state a container is in. The possible states can
       be found in as static variables in the {@link State} class.
@return the positions of the containers with the given container state
geode-assembly/geode-assembly-test/src/main/java/org/apache/geode/session/tests/ContainerManager.java