Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.*;
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- /**
- *
- * @author 232-1
- */
- public class MainClass {
- public static void main(String[] args) throws FileNotFoundException, IOException {
- List<String> L = new ArrayList<>();
- Collection<Object> C = new ArrayList<>();
- L.add("TEST1");
- L.add("TEST2");
- C.add("TEST");
- C.add(123);
- File file = new File("D:\\232-1\\fis1.txt");
- BufferedReader br = new BufferedReader(new FileReader(file));
- String st;
- List<String> words = new ArrayList<>();
- while ((st = br.readLine()) != null)
- words.addAll(Arrays.asList(st.split(" ")));
- Set<String> S = new HashSet<>(words);
- for(String listElem: S)
- System.out.println(listElem);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement