Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1.  
  2. import java.io.*;
  3. import java.util.*;
  4.  
  5. /*
  6. * To change this license header, choose License Headers in Project Properties.
  7. * To change this template file, choose Tools | Templates
  8. * and open the template in the editor.
  9. */
  10.  
  11. /**
  12. *
  13. * @author 232-1
  14. */
  15. public class MainClass {
  16. public static void main(String[] args) throws FileNotFoundException, IOException {
  17. List<String> L = new ArrayList<>();
  18.  
  19. Collection<Object> C = new ArrayList<>();
  20. L.add("TEST1");
  21. L.add("TEST2");
  22. C.add("TEST");
  23. C.add(123);
  24. File file = new File("D:\\232-1\\fis1.txt");
  25.  
  26. BufferedReader br = new BufferedReader(new FileReader(file));
  27.  
  28. String st;
  29. List<String> words = new ArrayList<>();
  30. while ((st = br.readLine()) != null)
  31. words.addAll(Arrays.asList(st.split(" ")));
  32. Set<String> S = new HashSet<>(words);
  33. for(String listElem: S)
  34. System.out.println(listElem);
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement