Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package StreamsFilesAndDirectories4;
- import java.io.IOException;
- import java.nio.file.Files;
- import java.nio.file.Path;
- import java.nio.file.Paths;
- import java.util.Collections;
- import java.util.List;
- public class SortLines {
- public static void main(String[] args) throws IOException {
- String inPath = "input.txt";
- String outPath = "output.txt";
- Path input = Paths.get(inPath);
- Path output = Paths.get(outPath);
- List<String> lines= Files.readAllLines(input);
- Collections.sort(lines);
- Files.write(output, lines);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment