A quick question and its probably the easiest answer, but I need to print a textual representation of my content HashMaps.
My code so far:
public void printAll() {
Set< String> Names = customersDetails.keySet();
Collection< CustomerDetails> eachCustomersNames = customersDetails.values();
for (String eachName : Names) {
System.out.println(eachName)
}
for (CustomerDetails eachCustomer : eachCustomersNames) {
System.out.println(eachCustomer);
}
}
But this leads to a list of keys and then to a list of values, but I need every line of text to read something like
Bob [example]
Where Bob is the key and example is the value.
source
share