Java Hashtable containsValue()方法与示例
哈希表类containsValue()方法 (Hashtable Class containsValue() method)
containsValue() method is available in java.util package.
containsValue()方法在java.util包中可用。
containsValue() method is used to check whether this table Hashtable associated one or more keys to the given value element (val_ele).
containsValue()方法用于检查此表Hashtable是否将一个或多个键关联到给定值元素(val_ele)。
containsValue() method is a non-static method, it is accessible with the class object only and if we try to access the method with the class name then we will get an error.
containsValue()方法是一个非静态方法,只能通过类对象访问,如果尝试使用类名称访问该方法,则会收到错误消息。
containsValue() method may throw an exception at the time of checking the key elements associated with the given value element (val_ele).
在检查与给定值元素(val_ele)相关的关键元素时, containsValue()方法可能会引发异常。
NullPointerException: This exception may throw when the given parameter is null exists.
NullPointerException :当给定参数为null时,可能引发此异常。
Syntax:
句法:
public boolean containsValue(Object val_ele);
Parameter(s):
参数:
Object val_ele – represents the value element (val_ele) is to be checked.
对象val_ele –表示要检查的值元素(val_ele)。
Return value:
返回值:
The return type of the method is boolean,
方法的返回类型为boolean 。
It returns true when at least one keys associated with the given value element (val_ele).
当至少有一个与给定值元素(val_ele)相关联的键时,它返回true 。
It returns false, when none keys associated with the given value element (val_ele).
当没有与给定值元素(val_ele)关联的键时,它返回false 。
Example:
例:
// Java program to demonstrate the example
// of boolean containsValue(Object val_ele)
// method of Hashtable
import java.util.*;
public class ContainsValueOfHashtable {public static void main(String[] args) {//Instantiate a hashtable object
Hashtable ht = new Hashtable();
// By using put() method is to
// add the linked values in an Hashtable
ht.put(10, "C");
ht.put(20, "C++");
ht.put(30, "JAVA");
ht.put(40, "PHP");
ht.put(50, "SFDC");
// Display Hashtable
System.out.println("Hashtable: " + ht);
// By using containsValue() method is to
// check whether the given value element
// atleast holds one key element or not
// in this Hashtable
boolean status = ht.containsValue("JAVA");
// Display Status
System.out.println("ht.containsValue(JAVA): " + status);
}
}
Output
输出量
Hashtable: {10=C, 20=C++, 30=JAVA, 40=PHP, 50=SFDC}
ht.containsValue(JAVA): true
翻译自: https://www.includehelp.com/java/hashtable-containsvalue-method-with-example.aspx
Java Hashtable containsValue()方法与示例相关推荐
- Java IOUtils.copy方法代码示例(亲测)
本文整理汇总了Java中org.apache.commons.io.IOUtils.copy方法的典型用法代码示例.如果您正苦于以下问题:Java IOUtils.copy方法的具体用法?Java I ...
- java hashtable put_Java Hashtable put()方法与示例
哈希表类put()方法put()方法在java.util包中可用. put()方法用于将给定的键元素(key_ele)放入给定的值元素(val_ele). put()方法是一个非静态方法,只能通过类对 ...
- java hashtable keys_Java Hashtable keys()方法与示例
哈希表类keys()方法keys()方法在java.util包中可用. keys()方法用于返回此Hashtable中的枚举键. keys()方法是一个非静态方法,只能通过类对象访问,如果尝试使用类名 ...
- containskey java_Java Hashtable containsKey()方法与示例
哈希表类containsKey()方法containsKey()方法在java.util包中可用. containsKey()方法用于检查给定对象是否为键元素(key_ele). containsKe ...
- java user directory,Java ProcessBuilder directory()方法与示例
语法:public File directory (); public ProcessBuilder directory (File dir); ProcessBuilder类directory()方 ...
- Java序列化魔术方法及其示例使用
在上一篇文章中, 您需要了解有关Java序列化的所有知识 ,我们讨论了如何通过实现Java序列化来启用类的可序列化性. Serializable接口. 如果我们的类未实现Serializable接口, ...
- catalog java,Java Connection getCatalog()方法与示例
通常,目录是一个目录,其中包含有关数据集,文件或数据库的信息.而数据库目录中包含所有数据库,基本表,视图(虚拟表),同义词,值范围,索引,用户和用户组的列表. Connection接口的getCata ...
- filepermission java,Java FilePermission getActions()方法与示例
FilePermission类getActions()方法getActions()方法在java.io包中可用. getActions()方法用于检查此FilePermission和给定对象在路径名和 ...
- java方法参数Bundle,Java ResourceBundle keySet()方法及示例
ResourceBundle类keySet()方法keySet()方法在java.util包中可用. keySet()方法用于从此ResourceBundle及其超级捆绑包中获取所有现有键,以在Set ...
最新文章
- 给迷茫的程序员一些中肯建议,你还在虚度光阴吗?
- 【最全干货下载】| DTCC 2020:阿里云数据库9大要点精彩回顾
- stack smash_扶手椅VGUX:Super Smash Bros.Ultimate
- 交叉验证 cross validation 与 K-fold Cross Validation K折叠验证
- 【CodeForces - 1201C】Maximum Median(思维,水题)
- JUnit5 @BeforeEach注解示例
- C++中使用剪贴板复制UNICODE/ANSI字符数据
- 贪心法——LeetCode 402 移除K个数字
- 设计模式-------建造者模式(生成器模式)
- 基于Python自动登录QQ空间过滑块验证
- 计算机二级mysql上机考试操作步骤_计算机二级mysql上机操作题怎么做
- OBS Studio安装教程以及录制等详细配置
- 大数据工程师学习计划
- Centos6安装SGE以及集群配置
- 怎么破解电脑系统管理员密码?黑客用cmd批处理命令
- 每天一剂 WebView 良药
- 3D折纸效果怎么实现?
- 真心付出的一方失恋为什么痛,甚至厌世?
- 串口驱动中使用FIFO
- 大数据平台监控指南(附技术选型、监控指标)
热门文章
- 从头搭建一个深度学习框架
- matlab与maple互联,Matlab,Maple和Mathematica三款主流科学计算软件的互操作
- mysql设置success信息_【原创】MySQL Cluster安装部署(Success)
- python编写递归函数和非递归函数、输出斐波那契数列_分别用非递归和递归的方法编写函数求斐波那契数列第n项。斐波那契数列1,1,2,3,5,8,13,…...
- percona-toolkit--pt-table-checksum
- Shell脚本——基础语法
- 10年老兵给程序员的10条建议!
- Spring的两种任务调度Scheduled和Async
- 简述container与container-fluid的区别
- Win10系列:VC++ 定时器