Just missing the last set of verification.
package com.codegym.task.task08.task0802;
/*
HashMap of 10 pairs
Create a HashMap<String, String>, and add 10 string pairs:
watermelon - melon,
banana - fruit,
cherry - fruit,
pear - fruit,
cantaloupe - melon,
blackberry - fruit,
ginseng - root,
strawberry - fruit,
iris - flower,
potato - tuber.
Display the contents of the collection, each element on a new line.
Example output: (here we just show one line):
potato - tuber
*/
import java.util.HashMap;
import java.util.Map;
public class Solution {
public static void main(String[] args) throws Exception {
HashMap<String, String> map = new HashMap<String, String>();
map.put("watermelon" , "fruit");
map.put("banana", "fruit");
map.put("cherry", "fruit");
map.put("pear", "fruit");
map.put("cantaloupe", "melon");
map.put("blackberry", "fruit");
map.put("ginseng", "root");
map.put("strawberry", "fruit");
map.put("iris", "flower");
map.put("potato", "tuber");
for(Map.Entry<String, String> text : map.entrySet()){
String key = text.getKey();
String value = text.getValue();
System.out.println(key + " - " + value);
}
}
}