Check if a particular value exists in Java Hashtable : Hashtable Basics « Collections « Java Tutorial

Java Tutorial
1. Language
2. Data Type
3. Operators
4. Statement Control
5. Class Definition
6. Development
7. Reflection
8. Regular Expressions
9. Collections
10. Thread
11. File
12. Generics
13. I18N
14. Swing
15. Swing Event
16. 2D Graphics
17. SWT
18. SWT 2D Graphics
19. Network
20. Database
21. Hibernate
22. JPA
23. JSP
24. JSTL
25. Servlet
26. Web Services SOA
27. EJB3
28. Spring
29. PDF
30. Email
31. J2ME
32. J2EE Application
33. XML
34. Design Pattern
35. Log
36. Security
37. Apache Common
38. Ant
39. JUnit
Java
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Tutorial » Collections » Hashtable Basics 
9. 48. 20. Check if a particular value exists in Java Hashtable
import java.util.Hashtable;

public class Main {
  public static void main(String[] args) {
    Hashtable<String, String> ht = new Hashtable<String, String>();

    ht.put("1""One");
    ht.put("2""Two");
    ht.put("3""Three");

    boolean blnExists = ht.contains("Two");
    System.out.println("Two exists in Hashtable ? : " + blnExists);
  }
}
9. 48. Hashtable Basics
9. 48. 1. Creating Hash Tables
9. 48. 2. Adding Key-Value Pairs
9. 48. 3. Get all keys and elements from a hash table
9. 48. 4. Copying all the key-value pairs from one Hashtable (or any Map) into another Hashtable: the putAll() method
9. 48. 5. Displaying Hash Table Contents
9. 48. 6. Removing Key-Value Pairs: call the remove() method with the specific key as its argument
9. 48. 7. To get rid of all key-value pairs: call the clear() method
9. 48. 8. Sizing Hash Tables
9. 48. 9. Fetching Keys and Values: the get() method
9. 48. 10. To perform some operation on all keys: the keys() or keySet() methods
9. 48. 11. Using the elements() or the values() method to get the set of all the values in the hash table
9. 48. 12. Getting elements (key-value pairs) from a Hashtable: the entrySet() method
9. 48. 13. Finding Elements
9. 48. 14. contains() and containsValue(): check to see if a specific value is found within the Hashtable
9. 48. 15. Cloning Hash Tables
9. 48. 16. Hashtable Immutability: to make the table read-only using Collections.unmodifiableMap(Map map)
9. 48. 17. Counting Word Occurrences with a hash table
9. 48. 18. uses a generic Hashtable to store the names of bank depositors and their current balances
9. 48. 19. Check if a particular key exists in Java Hashtable
9. 48. 20. Check if a particular value exists in Java Hashtable
9. 48. 21. Iterate through keys of Java Hashtable
9. 48. 22. Iterate through values of Java Hashtable
9. 48. 23. Remove all values from Java Hashtable
9. 48. 24. Remove value from Java Hashtable
9. 48. 25. Get Collection of Values from Hashtable
9. 48. 26. Get Set view of Keys from Hashtable
9. 48. 27. Scan the content of a hashtable
9. 48. 28. Sort keys in an Hashtable
9. 48. 29. Use iterators with a Hashtable.
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.