Inserting a text file into a hashset

F

farah_omarshah

Hi,

Ive written some code to feed a text file (a list of words) into a
program, as is shown below. My dilemma is how to get the program to
take the words in the text file and store them in a hash set. I need to
do this in order to later compare two lists of words.....can anyone
point me me in the right direction please??

import java.io.*;

public class FileIn {

BufferedReader in;
public FileIn() {
try {

in = new BufferedReader(new FileReader("\\C:\\Program
Files\\java.txt\\"));
String line = in.readLine();
System.out.println(line);


in.close();


} catch(IOException ioe) {
System.out.println(ioe.toString());
}
}

public static void main(String args[]) {

FileIn newFile = new FileIn();
}
}
 
T

tom fredriksen

Hi,

Ive written some code to feed a text file (a list of words) into a
program, as is shown below. My dilemma is how to get the program to
take the words in the text file and store them in a hash set. I need to
do this in order to later compare two lists of words.....can anyone
point me me in the right direction please??

why do you ask the same question twice?

/tom
 
F

farah

Please acept my apologies for the second post. Im new to google
groups. When i posted the first message, it didnt appear so i presumed
i had a made a mistake somewhere and posted second one.
Sorry, Farah
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top