I am unable to clear the last requirement.
I know that the values are displaying. I changed the values to be unique from the keys and they output correctly.
The code worked properly in the previous lesson for displaying the list of keys.
package com.codegym.task.task08.task0805;
import java.util.HashMap;
import java.util.Map;
import java.util.Iterator;
/*
Values on the screen!
*/
public class Solution {
public static void main(String[] args) throws Exception {
HashMap<String, String> map = new HashMap<String, String>();
map.put("Sim", "Sim");
map.put("Tom", "Tom");
map.put("Arbus", "Arbus");
map.put("Baby", "Baby");
map.put("Cat", "Cat");
map.put("Dog", "Dog");
map.put("Eat", "Eat");
map.put("Food", "Food");
map.put("Gevey", "Gevey");
map.put("Hugs", "Hugs");
printValues(map);
}
public static void printValues(HashMap<String, String> map) {
//write your code here
Iterator<Map.Entry<String, String>> iterator = map.entrySet().iterator();
while(iterator.hasNext())
{
HashMap.Entry<String, String> pair = iterator.next();
String value = pair.getValue();
System.out.println(value);
}
}
}