 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java IdentityHashMap containsValue() method
Use the containsValue() method to check for the existence of a value. First, create a IdentityHashMap −
Map<String, Integer> m = new IdentityHashMap<String, Integer>();
Add some elements −
m.put("1", 100); m.put("2", 200); m.put("3", 300); m.put("4", 150); m.put("5", 110); m.put("6", 50); m.put("7", 90); m.put("8", 250); m.put("9", 350); m.put("10", 450); Now check for the existence of a value −
m.containsValue(100))
The following is an example to implement containsValue() method −
Example
import java.util.*; public class Demo {    public static void main(String[] args) {       Map<String, Integer> m = new IdentityHashMap<String, Integer>();       m.put("1", 100);       m.put("2", 200);       m.put("3", 300);       m.put("4", 150);       m.put("5", 110);       m.put("6", 50);       m.put("7", 90);       m.put("8", 250);       m.put("9", 350);       m.put("10", 450);       System.out.println("IdentityHashMap elements\n"+ m);       System.out.println("Is value 100 in the Map? " + m.containsValue(100));    } }  Output
IdentityHashMap elements {2 = 200, 4 = 150, 9 = 350, 7 = 90, 10 = 450, 6 = 50, 5 = 110, 8 = 250, 1 = 100, 3 = 300} Is value 100 in the Map? trueAdvertisements
 