本文整理了Java中java.util.HashMap.containsValue()
方法的一些代码示例,展示了HashMap.containsValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HashMap.containsValue()
方法的具体详情如下:
包路径:java.util.HashMap
类名称:HashMap
方法名:containsValue
[英]Returns whether this map contains the specified value.
[中]返回此映射是否包含指定的值。
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
public boolean containsValue(Object value) {
return backingMap.containsValue( (V) value);
// for (int i = 0; i < entries.size(); i++){
// if (valEq(entries.get(i).value, value))
// return true;
// }
// return false;
}
代码示例来源:origin: commons-collections/commons-collections
/**
* Return <code>true</code> if this map contains one or more keys mapping
* to the specified value.
*
* @param value the value to be searched for
* @return true if the map contains the value
*/
public boolean containsValue(Object value) {
if (fast) {
return (map.containsValue(value));
} else {
synchronized (map) {
return (map.containsValue(value));
}
}
}
代码示例来源:origin: wildfly/wildfly
/**
* Return <code>true</code> if this map contains one or more keys mapping
* to the specified value.
*
* @param value the value to be searched for
* @return true if the map contains the value
*/
public boolean containsValue(Object value) {
if (fast) {
return (map.containsValue(value));
} else {
synchronized (map) {
return (map.containsValue(value));
}
}
}
代码示例来源:origin: org.codehaus.groovy/groovy
public boolean containsValue(Object value) {
return delegateMap.containsValue(value);
}
代码示例来源:origin: spotbugs/spotbugs
public void test3Bugs(HashMap<? extends CharSequence, ? extends CharSequence> map) {
map.containsValue(3);
map.containsKey(4.0);
map.get(5.0);
map.remove('r');
}
代码示例来源:origin: spotbugs/spotbugs
public void test1NoBugs(HashMap<String, String> map) {
map.containsKey("Key");
map.containsValue("Value");
map.get("Get");
map.remove("Remove");
}
代码示例来源:origin: spotbugs/spotbugs
public void test2Bugs(HashMap<CharSequence, CharSequence> map) {
map.containsValue(3);
map.remove(4);
map.get(5.0);
map.remove('r');
}
代码示例来源:origin: spotbugs/spotbugs
public void test4Bugs(HashMap<? super CharSequence, ? super CharSequence> map) {
map.containsValue(3);
map.containsKey('k');
map.get(5.0);
map.remove('r');
}
代码示例来源:origin: cmusphinx/sphinx4
void addInConv(String item, HashMap<String,String> conv) {
if (!conv.containsKey(item)) {
// new item
String cand = item.toUpperCase();
while (conv.containsValue(cand)) {
// conflict !
cand = cand+"_X";
}
conv.put(item,cand);
}
}
代码示例来源:origin: spotbugs/spotbugs
public void test2NoBugs(HashMap<CharSequence, CharSequence> map) {
map.containsValue(new StringBuffer("Value"));
map.get(new StringBuffer("Get"));
}
代码示例来源:origin: spotbugs/spotbugs
public void test4NoBugs(HashMap<? super CharSequence, ? super CharSequence> map) {
map.containsValue(new StringBuffer("Value"));
map.get(new StringBuffer("Get"));
}
代码示例来源:origin: spotbugs/spotbugs
public void test3NoBugs(HashMap<? extends CharSequence, ? extends CharSequence> map) {
map.containsValue(new StringBuffer("Value"));
map.get(new StringBuffer("Get"));
map.remove(new StringBuffer("Remove"));
}
代码示例来源:origin: spotbugs/spotbugs
public void test1aBugs(HashMap<? extends String, String> map) {
map.containsKey(new StringBuffer("Key"));
map.containsValue(new StringBuffer("Value"));
map.get(new StringBuffer("Get"));
map.remove(new StringBuffer("Remove"));
}
代码示例来源:origin: spotbugs/spotbugs
public void test1Bugs(HashMap<String, String> map) {
map.containsKey(new StringBuffer("Key"));
map.containsValue(new StringBuffer("Value"));
map.get(new StringBuffer("Get"));
map.remove(new StringBuffer("Remove"));
}
代码示例来源:origin: apache/rocketmq
private boolean isBrokerInNameServer(final String brokerAddr) {
Iterator<Entry<String, TopicRouteData>> it = this.topicRouteTable.entrySet().iterator();
while (it.hasNext()) {
Entry<String, TopicRouteData> itNext = it.next();
List<BrokerData> brokerDatas = itNext.getValue().getBrokerDatas();
for (BrokerData bd : brokerDatas) {
boolean contain = bd.getBrokerAddrs().containsValue(brokerAddr);
if (contain)
return true;
}
}
return false;
}
/**
代码示例来源:origin: apache/rocketmq
public static String fetchBrokerNameByAddr(final MQAdminExt adminExt, final String addr) throws Exception {
ClusterInfo clusterInfoSerializeWrapper = adminExt.examineBrokerClusterInfo();
HashMap<String/* brokerName */, BrokerData> brokerAddrTable = clusterInfoSerializeWrapper.getBrokerAddrTable();
Iterator<Map.Entry<String, BrokerData>> it = brokerAddrTable.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, BrokerData> entry = it.next();
HashMap<Long, String> brokerAddrs = entry.getValue().getBrokerAddrs();
if (brokerAddrs.containsValue(addr)) {
return entry.getKey();
}
}
throw new Exception(ERROR_MESSAGE);
}
代码示例来源:origin: MorphiaOrg/morphia
@Override
public boolean containsValue(final Object value) {
return realMap.containsValue(value);
}
代码示例来源:origin: apache/rocketmq
private boolean isBrokerAddrExistInTopicRouteTable(final String addr) {
Iterator<Entry<String, TopicRouteData>> it = this.topicRouteTable.entrySet().iterator();
while (it.hasNext()) {
Entry<String, TopicRouteData> entry = it.next();
TopicRouteData topicRouteData = entry.getValue();
List<BrokerData> bds = topicRouteData.getBrokerDatas();
for (BrokerData bd : bds) {
if (bd.getBrokerAddrs() != null) {
boolean exist = bd.getBrokerAddrs().containsValue(addr);
if (exist)
return true;
}
}
}
return false;
}
代码示例来源:origin: spotbugs/spotbugs
public void testOne() {
HashMap<String, String> m = new HashMap<String, String>();
m.put("a", "a");
assertFalse(m.containsKey(1));
assertFalse(m.containsValue(1));
assertFalse(m.entrySet().contains(1));
assertFalse(m.keySet().contains(1));
assertFalse(m.values().contains(1));
}
代码示例来源:origin: north2016/T-MVP
@SingleClick // 防止连续点击
public static void go(String actionName, HashMap data, View view) {
if (data.containsValue(null)) return;
TRouter.go(actionName, data, view);
}
}
内容来源于网络,如有侵权,请联系作者删除!