List of usage examples for java.util Map get
V get(Object key);
From source file:Main.java
public static <K> Map<K, Integer> add(Map<K, Integer> map, K k, int add) { Integer value = map.get(k); if (value == null) value = 0;/*from www . j a va2 s.co m*/ value += add; map.put(k, value); return map; }
From source file:nu.yona.server.batch.quartz.jobs.PinResetConfirmationCodeSenderQuartzJob.java
private static UUID getUserId(Map<String, Object> parameterMap) { return UUID.fromString((String) parameterMap.get(USER_ID_KEY)); }
From source file:Main.java
@SuppressWarnings({ "rawtypes" }) private static final int getFreq(final Object obj, final Map freqMap) { final Integer count = (Integer) freqMap.get(obj); if (count != null) { return count.intValue(); }/* w w w .ja v a2s.com*/ return 0; }
From source file:Main.java
public static <K> Map<K, Double> add(Map<K, Double> map, K k, double add) { Double value = map.get(k); if (value == null) value = 0.0;// w ww . j av a 2 s . co m value += add; map.put(k, value); return map; }
From source file:Main.java
public final static <GPOutput> boolean isMapComplete(final Map<Integer, GPOutput> map, final int size) { for (int i = 0; i < size; i++) { if (map.get(Integer.valueOf(i)) == null) { return false; }//from ww w.j a v a 2 s . c om } return true; }
From source file:Main.java
public static <V> void appendMaps(Map<Integer, V> A, Map<Integer, V> B) { int index = A.size(); for (int i : B.keySet()) { A.put(index, B.get(i)); index++;//from w w w .j a va 2 s.c o m } }
From source file:models.daos.UserDao.java
public static ObjectNode getWatchers(String datasetName) { List<String> watchUsers = new ArrayList<String>(); if (StringUtils.isNotBlank(datasetName)) { Map<String, Object> params = new HashMap<>(); params.put("name", datasetName); List<Map<String, Object>> rows = null; rows = JdbcUtil.wherehowsNamedJdbcTemplate.queryForList(GET_USERS_WATCHED_DATASET, params); for (Map row : rows) { String userName = (String) row.get("username"); watchUsers.add(userName);// w w w. ja v a2s. co m } } ObjectNode result = Json.newObject(); result.put("count", watchUsers.size()); result.set("users", Json.toJson(watchUsers)); return result; }
From source file:Main.java
public static Object get(Object key) { @SuppressWarnings("rawtypes") Map m = (Map) ctx.get(); if (m != null) { return m.get(key); }/* w w w . j a v a2 s .c o m*/ return null; }
From source file:Main.java
public static String getSingleOptionalParameter(Map<String, String[]> requestParameters, String parameterName) { String[] values = requestParameters.get(parameterName); if (values == null || values.length == 0) { return null; } else if (values.length > 1) { throw new IllegalArgumentException( "Expected just one request parameter named " + parameterName + " but got " + values.length); } else {/* w ww . ja v a2 s . com*/ return values[0]; } }
From source file:Main.java
public static <K, V> V getValue(Map<K, V> map, K key) { if (map == null) { return null; }/*w w w.j a v a 2 s. com*/ return map.get(key); }