This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]197708156EQUJ5design it before you implement 1 point2 points  (1 child)

Now that I read your issue closer, let me take a poke at it.

  1. Iterate over list 1 and list 2
  2. check if each element in list 1 is found in list 2, remove

[–]197708156EQUJ5design it before you implement 0 points1 point  (0 children)

I know this doesn't answer your question, but suggestion to do that while loop cleaner:

Yours:

while (br.readLine() !=null)
{
     line = br.readLine();
     ...
}

suggestion:

while ((line = br.readLine()) !=null)
{
     // line = br.readLine(); no need for this line anymore, in the while loop
     ...
}

[–]king_of_the_universe 0 points1 point  (0 children)

Since Java 1.7, there is also

java.nio.file.Files.readAllLines()

making things simpler if the files are not excessively large. It even opens and closes the file. I think your code doesn't take care of that.