List of usage examples for java.util Map containsValue
boolean containsValue(Object value);
From source file:MainClass.java
public static void main(String[] a) { Map map = new HashMap(); map.put("key1", "value1"); map.put("key2", "value2"); map.put("key3", "value3"); System.out.println(map.containsKey("key1")); System.out.println(map.containsValue("value2")); }
From source file:Main.java
public static void main(String[] a) { Map<String, String> map = new HashMap<String, String>(); map.put("key1", "value1"); map.put("key2", "value2"); map.put("key3", "value3"); System.out.println(map.containsKey("key1")); System.out.println(map.containsValue("value2")); }
From source file:Main.java
public static void main(String args[]) { Map<String, Integer> atomNums = new TreeMap<String, Integer>(); atomNums.put("A", 1); atomNums.put("B", 2); atomNums.put("C", 3); atomNums.put("D", 4); atomNums.put("E", 5); atomNums.put("F", 6); System.out.println("The map contains these " + atomNums.size() + " entries:"); Set<Map.Entry<String, Integer>> set = atomNums.entrySet(); for (Map.Entry<String, Integer> me : set) { System.out.print(me.getKey() + ", Atomic Number: "); System.out.println(me.getValue()); }//www . j av a2s. c o m TreeMap<String, Integer> atomNums2 = new TreeMap<String, Integer>(); atomNums2.put("Q", 30); atomNums2.put("W", 82); atomNums.putAll(atomNums2); set = atomNums.entrySet(); System.out.println("The map now contains these " + atomNums.size() + " entries:"); for (Map.Entry<String, Integer> me : set) { System.out.print(me.getKey() + ", Atomic Number: "); System.out.println(me.getValue()); } if (atomNums.containsKey("A")) System.out.println("A has an atomic number of " + atomNums.get("A")); if (atomNums.containsValue(82)) System.out.println("The atomic number 82 is in the map."); System.out.println(); if (atomNums.remove("A") != null) System.out.println("A has been removed.\n"); else System.out.println("Entry not found.\n"); Set<String> keys = atomNums.keySet(); for (String str : keys) System.out.println(str + " "); Collection<Integer> vals = atomNums.values(); for (Integer n : vals) System.out.println(n + " "); atomNums.clear(); if (atomNums.isEmpty()) System.out.println("The map is now empty."); }
From source file:Main.java
final static public boolean containsValue(Map<Object, Object> collection, Object item) { return collection != null && collection.containsValue(item); }
From source file:Main.java
public static final boolean containsValue(Object key) { Map<Object, Object> cache = LOCAL_CACHE.get(); return cache != null && cache.containsValue(key); }
From source file:Main.java
final static public boolean containsValue(Map collection, Object item) { return collection != null && collection.containsValue(item); }
From source file:Main.java
public static <T, U> boolean containsValue(Map<T, U> map, U value) { if (map == null) { return false; }//from w ww .j a v a 2 s . c o m return map.containsValue(value); }
From source file:gov.nist.healthcare.ttt.webapp.common.controller.GetCCDADocumentsController.java
public static boolean containsName(List<Map> json, String value) { for (Map obj : json) { if (obj.containsValue(value)) { return true; }/*from w w w .j a va2 s. c om*/ } return false; }
From source file:com.tdclighthouse.prototype.utils.TdcUtils.java
public static boolean mapContainsValue(@SuppressWarnings("rawtypes") Map map, Object value) { return map.containsValue(value); }
From source file:service.ProcessService.java
private static boolean run(Map<DSLContainer, Object> dcMap) throws DfException, SQLException { boolean result = true; NestedTx dqlTx = null;/*from w w w . j av a 2 s .c o m*/ try { IDfSession session = null; if (dcMap.containsValue("dql")) { session = Utils.getSessionFromConfig(); dqlTx = NestedTx.beginTx(session); } JdbcTemplate dbTemplate = null; if (dcMap.containsValue("sql")) { dbTemplate = JdbcTemplateFactory.getProjectDBTemplate(); } for (Map.Entry<DSLContainer, Object> entry : dcMap.entrySet()) { result &= (Boolean) DSLManager.executeDC(entry.getKey(), entry.getValue().equals("dql") ? session : dbTemplate); } logger.info("Total execution result is " + result); if (result && dqlTx != null) { dqlTx.okToCommit(); } } catch (DfException e) { logger.error(e); throw e; } catch (SQLException e) { logger.error(e); throw e; } finally { if (dqlTx != null) { dqlTx.commitOrAbort(); } } return result; }