#fixed code
                              @Override
  public Map<WorkflowInstance, RunState> activeStates() {
    return states.entrySet().stream()
        .collect(Collectors.toMap(Map.Entry::getKey, (entry) -> entry.getValue().runState));
  }
#vulnerable code 
                              @Override
  public Map<WorkflowInstance, RunState> activeStates() {
    final ImmutableMap.Builder<WorkflowInstance, RunState> builder = ImmutableMap.builder();
    states.entrySet().forEach(entry -> builder.put(entry.getKey(), entry.getValue().runState));
    return builder.build();
  } 
                            #location 2 
                            #vulnerability type CHECKERS_IMMUTABLE_CAST