code: public <U> Leader<U> map(Function<T, U> mapper) {
      return new Leader<>(mapper.apply(id), term, termStartTime);
    }
docs: Converts the leader identifier using the given mapping function.
  
  @param mapper the mapping function with which to convert the identifier
  @param <U>    the converted type
  @return the converted leader object