12:37 am - Monday August 21, 2017

Check whether the value is available in HashMap boolean containsValue(Object value)

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044

BACK

                      This function returns true if this map maps more than one keys to the given value.

Example Program

import java.util.HashMap;

public class Containsvalue 
 {

	public static void main(String args[])

	{

		HashMap hp = new HashMap();

		hp.put("1", "java");

		hp.put("2", "c++");

		hp.put("3", "dbms");

		hp.put("4", "oops");

		System.out.println("Returns:" + hp.containsValue("c++"));

		System.out.println("Returns:" + hp.containsValue("oops"));

	}

}

Output

  Returns: true

  Returns: true

BACK

Filed in: Java Examples

Comments are closed.