Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.BufferedReader;
- import java.io.FileNotFoundException;
- import java.io.FileReader;
- import java.util.ArrayList;
- import java.util.Scanner;
- public class File {
- String fileName;
- ArrayList<String> filelist;
- File(String fileName, ArrayList<String> filelist) {
- this.fileName = fileName;
- this.filelist = new ArrayList<String>();
- }
- public static ArrayList<String> readFile(String name) throws FileNotFoundException {
- Scanner scanner = null;
- scanner = new Scanner(new BufferedReader(new FileReader(name)));
- ArrayList<String> filelist = new ArrayList<String>();
- while (scanner.hasNextLine()) {
- filelist.add(scanner.nextLine());
- } return filelist;
- }
- }
- import java.util.ArrayList;
- public class Spy extends Thread {
- ArrayList<File> fileCollection;
- public Spy () {
- this.fileCollection = new ArrayList<File> ();
- }
- public void addFile (File file) throws InterruptedException {
- this.fileCollection.add(file);
- }
- public void observeFile () {
- for (File fileobservable : fileCollection) {
- if (fileCollection.get(0).equals(fileCollection.get(1))) {
- System.out.print("true"+fileobservable);
- } else {
- System.out.print("hhh");
- }
- }
- }
- public void run() {
- this.observeFile();
- }
- public void addFile(ArrayList<String> file1) {
- // TODO Auto-generated method stub
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement