@Test public void testToPaddedStrings() { assertThat(AnalyzeCommand.toPaddedStrings(ImmutableList.of())) .containsExactly(); assertThat(AnalyzeCommand.toPaddedStrings(ImmutableList.of(""))) .containsExactly(""); assertThat(AnalyzeCommand.toPaddedStrings(ImmutableList.of("", " "))) .containsExactly(" ", " "); assertThat(AnalyzeCommand.toPaddedStrings(ImmutableList.of("abc", ""))) .containsExactly("abc", " "); assertThat(AnalyzeCommand.toPaddedStrings(ImmutableList.of("ab", "CD", "eF"))) .containsExactly("ab", "CD", "eF"); assertThat(AnalyzeCommand.toPaddedStrings(ImmutableList.of("ABC", "defg", "HiJ Kl", "mn"))) .containsExactly("ABC ", "defg ", "HiJ Kl", "mn "); }
static List<String> toPaddedStrings(final List<String> strings) { final int maxLen = strings.stream() .map(String::length) .max(Integer::compareTo) .orElse(0); return strings.stream() .map(s -> Strings.padEnd(s, maxLen, ' ')) .collect(Collectors.toList()); }
AnalyzeCommand { static List<String> toPaddedStrings(final List<String> strings) { final int maxLen = strings.stream() .map(String::length) .max(Integer::compareTo) .orElse(0); return strings.stream() .map(s -> Strings.padEnd(s, maxLen, ' ')) .collect(Collectors.toList()); } }
AnalyzeCommand { static List<String> toPaddedStrings(final List<String> strings) { final int maxLen = strings.stream() .map(String::length) .max(Integer::compareTo) .orElse(0); return strings.stream() .map(s -> Strings.padEnd(s, maxLen, ' ')) .collect(Collectors.toList()); }  }
AnalyzeCommand { static List<String> toPaddedStrings(final List<String> strings) { final int maxLen = strings.stream() .map(String::length) .max(Integer::compareTo) .orElse(0); return strings.stream() .map(s -> Strings.padEnd(s, maxLen, ' ')) .collect(Collectors.toList()); }  static void main(String[] args); }
AnalyzeCommand { static List<String> toPaddedStrings(final List<String> strings) { final int maxLen = strings.stream() .map(String::length) .max(Integer::compareTo) .orElse(0); return strings.stream() .map(s -> Strings.padEnd(s, maxLen, ' ')) .collect(Collectors.toList()); }  static void main(String[] args);  }