if (stateTransitions.isEmpty()) {
throw new IllegalArgumentException("No start state was found. You must specify at least one step in a job.");
}
for (StateTransition stateTransition : stateTransitions) {
State state = stateTransition.getState();
String stateName = state.getName();
stateMap.put(stateName, state);
}
for (StateTransition stateTransition : stateTransitions) {
State state = stateTransition.getState();
if (!stateTransition.isEnd()) {
String next = stateTransition.getNext();
if (!stateMap.containsKey(next)) {
throw new IllegalArgumentException("Missing state for [" + stateTransition + "]");
}
}
else {
hasEndStep = true;
}
String name = state.getName();
Set<StateTransition> set = transitionMap.get(name);
if (set == null) {
// If no comparator is provided, we will maintain the order of insertion
if(stateTransitionComparator == null) {