3:06 pm - Sunday September 26, 2573

Search for given value in LinkedHashMap 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

                              The method boolean ContainsValue(Object value) checks whether the value is present in the map. If the value present in the map ,it returns true.Otherwise it returns false.

Example Program


import java.util.LinkedHashMap;

public class LinkedHashMapContainsValue 
{
	public static void main(String[] args) 
      {

		LinkedHashMap lhm = new LinkedHashMap();

		lhm.put("Add", "+");

		lhm.put("Sub", "-");

		lhm.put("Mul", "*");

		System.out.println("Map:" + lhm);

		System.out.println("" + lhm.containsValue("-"));

		System.out.println("" + lhm.containsValue('/'));

	}

}


Output

   Map:{Add=+, Sub=-, Mul=*}

   true

   false

BACK

Filed in: Java Examples

Comments are closed.