What is the best way to iterate through a LinkedHashMap to the xth element ?
for (Entry<String, Integer> entry : existingFile.entrySet() )
{
builder.append("{" + entry.getKey() + "," + entry.getValue() + "} ");
}
This iterates to through all the elements, how can I stop it say at the 5th element ?
Use a counter: