protected static List<HostRoleCommand> getHostRoleCommandsOfRole(List <HostRoleCommand> hostRoleCommands, final Role role) {
    Predicate<HostRoleCommand> predicate = new Predicate<HostRoleCommand>() {
      @Override
      public boolean apply(HostRoleCommand hrc) {
        return hrc.getRole() ==  role;
      }
    };
    return FluentIterable.from(hostRoleCommands)
        .filter(predicate)
        .toList();
  }
@param hostRoleCommands list of {@link HostRoleCommand}
@param role {@link Role}
@return list of {@link HostRoleCommand} that belongs to {@link Role}
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CalculatedStatus.java