Java Collection Tutorial - Java HashMap.containsValue(Object value)


HashMap.containsValue(Object value) has the following syntax.

public boolean containsValue(Object value)


In the following code shows how to use HashMap.containsValue(Object value) method.

/*from   w w w  .  j  av  a  2  s. c om*/
import java.util.HashMap;

public class Main {
   public static void main(String args[]) {
      HashMap<Integer, String> newmap = new HashMap<Integer, String>();      
      // populate hash map
      newmap.put(1, "tutorials");
      newmap.put(2, "from");
      newmap.put(3, "");
      // check existence of value 'point'
      System.out.println("Check if value 'point' exists: " + 

The code above generates the following result.