/** * @author lautturi.com * Java example: hashmap contains */ import java.util.*; public class Lautturi { public static void main(String[] args) { HashMap hash_map = new HashMap(); hash_map.put(1,"Apple"); hash_map.put(2,"Banana"); hash_map.put(3,"Cherry"); hash_map.put(4,"Orange"); String searchValue = "Banana"; if(hash_map.containsValue(searchValue)) { System.out.println("The map maps the value"); } } }