I need a key-value pair and I need to iterate over it, but I need to remove the &
from the last iteration.
My key-value Map object is defined as:
private Map<String, String> additionalAttributes = new HashMap<String,String>();
I perform my iteration as such:
for(Entry<String,String> i : additionalAttributes.entrySet()) {
attributes += i.getKey() + "=" +i.getValue() + "&";
}
Is there any way I can determine if the current entry i
is the last entry in the map? The map will vary in size and contents each time it's run so I need a dynamic solution.