Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package pl.borowa.springtest.domain;
- import java.io.*;
- import java.util.Scanner;
- import java.util.Set;
- import java.util.TreeSet;
- public class jakasJava {
- public static void main(String[] args) {
- Set<Integer> liczby = new TreeSet<>();
- try(Scanner file = new Scanner(new File("C:\\Users\\Borowa\\IdeaProjects\\springtest_annotation_config\\src\\main\\java\\pl\\borowa\\springtest\\domain\\liczby.txt"))) {
- while (file.hasNextLine()) {
- liczby.add(Integer.parseInt(file.nextLine()));
- }
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- }
- try (PrintWriter save = new PrintWriter("C:\\Users\\Borowa\\IdeaProjects\\springtest_annotation_config\\src\\main\\java\\pl\\borowa\\springtest\\domain\\liczby_save.txt")) {
- liczby.forEach(save::println);
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement