How to make this print only the first 200 results?
This piece of code prints everything that it finds. I want to print only the first 200 results. Here is the code
Code :
for (String key : data.keySet()) {
Set<File> files = data.get(key);
for (File file : files) {
out.println("<TR valign=top>");
out.println("<TD align=left><div class=\"wpmd\">");
out.println("<div><font color=\"#000000\">"+pathValue+(file.getPath().replace('\\', '/'))+ "</font></div>");
out.println("</TD>");
out.println("</TR>");
}
}
The type of data is:
Code :
public class Data extends HashMap<String, Set<File>> {
}
Data data=.....
Re: How to make this print only the first 200 results?
Use a counter in the output generating loop. When the counter reaches the desired value, exit the loops.
See the break statement.
Re: How to make this print only the first 200 results?
Quote:
Originally Posted by
Norm
Use a counter in the output generating loop. When the counter reaches the desired value, exit the loops.
See the break statement.
Thank you, it worked!