i have several String patterns:
ArrayList<String> tmp = new ArrayList<String>();
tmp.add("INFO");
tmp.add("Error");
tmp.add("Debug");
tmp.add("Failed");
tmp.add("Unable");
also i am checking the every lines in the file whether lines are matched with any one of the string pattern.if matched,i will display the line.my code is,
for (String pattern : tmp) {
if (line.contains(pattern)) {
System.out.println(line);
}
}
Now the problem is,if line match with more than one string pattern,line gets displayed by every time whenever gets matched.
i want to display the line by only one time(need to check any of the string patterns are matched with line).How to do this.