Hacker News new | ask | show | jobs
by fnord123 2472 days ago
This looks like the Java if the Java was written by someone who knows Java:

    List<String> alignText(List<String> texts) {
      int maxLength = texts.stream().mapToInt(String::length).max().orElse(0);
      return texts.stream().map(text -> {
        var spaceCount = (maxLength - text.length()) / 2;
        return " ".repeat(spaceCount) + text;
      }).collect(Collectors.toList());
    }
1 comments

/nit Move the lambda to private method and replace it with method reference and it’ll be just perfect
Good feedback. +1