F
farah
Hi,
The following code was repeated three times to store 3 files into 3
individual hash sets. I now need to compare file A to file B, i want to
see how many of the words in set A are also on set B. (Each set
contains the same number of words). Im not sure how to implement this,
can anyone help??
public FileIn() {
try {
// make sure there is a text file in the java directory where the java
// code is saved
in = new BufferedReader(new FileReader("C:\\Program
Files\\Java\\example.txt"));
set = new HashSet();
int Len = 1;
while(Len>0) {
String line = in.readLine();
try {
Len = line.length();
System.out.println(line);
set.add(line);
} catch(NullPointerException npe){
Len = 0; //no more file to read
}
}
The following code was repeated three times to store 3 files into 3
individual hash sets. I now need to compare file A to file B, i want to
see how many of the words in set A are also on set B. (Each set
contains the same number of words). Im not sure how to implement this,
can anyone help??
public FileIn() {
try {
// make sure there is a text file in the java directory where the java
// code is saved
in = new BufferedReader(new FileReader("C:\\Program
Files\\Java\\example.txt"));
set = new HashSet();
int Len = 1;
while(Len>0) {
String line = in.readLine();
try {
Len = line.length();
System.out.println(line);
set.add(line);
} catch(NullPointerException npe){
Len = 0; //no more file to read
}
}