public <U> Leadership<U> map(Function<T, U> mapper) {
    return new Leadership<>(
        leader != null ? leader.map(mapper) : null,
        candidates.stream().map(mapper).collect(Collectors.toList()));
  }
public < U > Leadership < U > map ( Function < T , U > mapper ) { return new Leadership < > ( leader != null ? leader . map ( mapper ) : null , candidates . stream ( ) . map ( mapper ) . collect ( Collectors . toList ( ) ) ) ; }
Maps the leadership identifiers using the given mapper.

@param mapper the mapper with which to convert identifiers
@param <U>    the converted identifier type
@return the converted leadership