Skip to content

Instantly share code, notes, and snippets.

@RMuskovets
Created December 11, 2019 19:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RMuskovets/75d48b317d6e09af8fabe31f71756bdf to your computer and use it in GitHub Desktop.
Save RMuskovets/75d48b317d6e09af8fabe31f71756bdf to your computer and use it in GitHub Desktop.
com.javarush.task.task36.task3605
package com.javarush.task.task36.task3605;
import java.util.*;
import java.nio.file.*;
import java.io.*;
/*
Использование TreeSet
*/
public class Solution {
public static void main(String[] args) throws IOException {
Files.lines(Paths.get(args[0]))
.map(String::toLowerCase)
.flatMapToInt(String::chars)
.distinct()
.filter(Character::isAlphabetic)
.sorted()
.limit(5)
.mapToObj(x -> (char)x)
.forEach(System.out::print);
System.out.println();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment