La méthode contains() de Hashtable retourne true si la valeur recherchée se trouve dans la collection Hashtable, sinon elle retourne une valeur false.
import java.util.Hashtable;Exécution:
public class Main {
public static void main(String[] args) {
Hashtable<String, String> ht = new Hashtable<String, String>();
ht.put("1", "un");
ht.put("2", "deux");
ht.put("3", "trois");
boolean b = ht.contains("trois");
System.out.println("La valeur trois existe dans Hashtable ? : " + b);
}
}
La valeur trois existe dans Hashtable ? :true
Commentaires (0)
Laisser un commentaire
Connectez-vous pour commenter
Rejoignez la discussion et partagez vos connaissances avec la communauté
Chargement des commentaires...