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;Runtime:
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);
}
}
The value three exists in Hashtable? :true
Commentaires (0)
Laisser un commentaire
Connectez-vous pour commenter
Rejoignez la discussion et partagez vos connaissances avec la communauté
Chargement des commentaires...