12:15 pm - Sunday June 25, 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 a  set view of the keys contained in the map.

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.