Check if a value exists in Hashtable in Java

The method contains() of Hashtable returns true if the value you are looking for is in the Hashtable collection, otherwise it returns a false.

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 b = ht.contains("three");
System.out.println("Does the value three exist in Hashtable?: " + b);
}
}
Runtime:

The value three exists in Hashtable? :true