Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.nio.file.Files;
- import java.nio.file.Paths;
- public class Pr01StudentsByGroup {
- public static void main(String[] args) {
- final String dataFile = "src\\Lesson07BuiltInQueryMethodsStreamAPI\\Resources\\StudentData.txt";
- try (BufferedReader br = Files.newBufferedReader(Paths.get(dataFile))) {
- br.lines()
- .skip(1)
- .map(line -> line.split("\\s+"))
- .filter(x -> "2".equals(x[5]))
- .map(x -> x[1] + " " + x[2])
- .sorted()
- .forEach(System.out::println);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement