Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -5,21 +5,21 @@ import java.util.List;
|
|||
|
||||
public final class OrderedWords {
|
||||
|
||||
public static void main(String[] aArgs) throws IOException {
|
||||
List<String> ordered = Files.lines(Path.of("unixdict.txt"))
|
||||
.filter( word -> isOrdered(word) ).toList();
|
||||
|
||||
final int maxLength = ordered.stream().map( word -> word.length() ).max(Integer::compare).get();
|
||||
ordered.stream().filter( word -> word.length() == maxLength ).forEach(System.out::println);
|
||||
}
|
||||
|
||||
private static boolean isOrdered(String aWord) {
|
||||
return aWord.chars()
|
||||
.mapToObj( i -> (char) i )
|
||||
.sorted()
|
||||
.map(String::valueOf)
|
||||
.reduce("", String::concat)
|
||||
.equals(aWord);
|
||||
}
|
||||
public static void main(String[] aArgs) throws IOException {
|
||||
List<String> ordered = Files.lines(Path.of("unixdict.txt"))
|
||||
.filter( word -> isOrdered(word) ).toList();
|
||||
|
||||
final int maxLength = ordered.stream().map( word -> word.length() ).max(Integer::compare).get();
|
||||
ordered.stream().filter( word -> word.length() == maxLength ).forEach(System.out::println);
|
||||
}
|
||||
|
||||
private static boolean isOrdered(String aWord) {
|
||||
return aWord.chars()
|
||||
.mapToObj( i -> (char) i )
|
||||
.sorted()
|
||||
.map(String::valueOf)
|
||||
.reduce("", String::concat)
|
||||
.equals(aWord);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue