List of usage examples for com.google.common.collect Maps newHashMap
public static <K, V> HashMap<K, V> newHashMap()
From source file:de.cosmocode.collections.CollectionFactory.java
/** * Transforms the keys of a map./*from w w w . j ava2s. co m*/ * * @param <K> the generic key type of the given map * @param <V> the generic value type of the given map * @param <N> the generic key type of the map being returned * @param from the map being used for transformation * @param function a {@link Function} used to convert every key in from * @return the transformed map */ public static <K, V, N> Map<N, V> transformKeys(Map<K, V> from, Function<? super K, ? extends N> function) { final Map<N, V> to = Maps.newHashMap(); for (Map.Entry<K, V> entry : from.entrySet()) { final N key = function.apply(entry.getKey()); final V value = entry.getValue(); to.put(key, value); } return to; }
From source file:net.liuxuan.UI.DataHolder.MapDataHolder.java
/** * ??Map */ public MapDataHolder() { this.data = Maps.newHashMap(); }
From source file:com.lcw.one.modules.sys.utils.DictUtils.java
public static List<Dict> getDictList(String type) { @SuppressWarnings("unchecked") Map<String, List<Dict>> dictMap = (Map<String, List<Dict>>) CacheUtils.get(CACHE_DICT_MAP); if (dictMap == null) { dictMap = Maps.newHashMap(); for (Dict dict : dictService.findAllList()) { List<Dict> dictList = dictMap.get(dict.getType()); if (dictList != null) { dictList.add(dict);/*from w w w.j a v a 2 s . com*/ } else { dictMap.put(dict.getType(), Lists.newArrayList(dict)); } } CacheUtils.put(CACHE_DICT_MAP, dictMap); } List<Dict> dictList = dictMap.get(type); if (dictList == null) { dictList = Lists.newArrayList(); } return dictList; }
From source file:org.graylog2.shared.metrics.MetricUtils.java
public static Map<String, Object> mapAllFiltered(Map<String, Metric> metrics, Set<String> blacklist) { Map<String, Object> result = Maps.newHashMap(); if (metrics == null) { return result; }// ww w .ja va 2s. c om for (Map.Entry<String, Metric> metric : metrics.entrySet()) { boolean filtered = false; if (blacklist != null) { for (String x : blacklist) { if (metric.getKey().startsWith(x)) { filtered = true; break; } } } if (filtered) { continue; } result.put(metric.getKey(), map(metric.getKey(), metric.getValue())); } return result; }
From source file:natlab.LookupFile.java
private static HashMap<String, String> initialize() { try {//from w w w . j a v a2 s . c om InputStream fin = LookupFile.class.getResourceAsStream("builtin.ser"); ObjectInputStream oin = new ObjectInputStream(fin); HashMap<String, HashMap<String, String>> map = (HashMap<String, HashMap<String, String>>) oin .readObject(); builtinPackages = map.get("packages"); builtinClasses = map.get("classes"); builtinFunctions = map.get("functions"); outputInfo = map.get("output_info"); currentFile = Maps.newHashMap(); lib = Maps.newHashMap(); return builtinClasses; } catch (FileNotFoundException e) { e.printStackTrace(); System.err.println("Library definitions file not found."); } catch (Exception e) { e.printStackTrace(); System.err.println("Error while loading library definition file"); } return null; }
From source file:com.liveramp.megadesk.base.state.InMemoryPersistenceTransaction.java
public InMemoryPersistenceTransaction() { writes = Maps.newHashMap(); }
From source file:easycare.cuke.pageObjects.patient.PatientPhysicianConfirmAddUserPage.java
@SuppressWarnings("unchecked") @Override/*from w w w.j a va2s. co m*/ public List<Map<String, String>> getDetailsOnPage() { Map<String, String> detailsRow = Maps.newHashMap(); addOrgDetailsToPageDetails(detailsRow); detailsRow.put("Physician Name", physicianName.getText()); try { detailsRow.put("Physician License number", physicianLicenseNumber.getText()); } catch (NoSuchElementException ex) { detailsRow.put("Physician License number", "<BLANK>"); } return Lists.newArrayList(detailsRow); }
From source file:com.google.gwt.jvm.mock.JavaCurrencyCodeMapConstants.java
public Map<String, String> currencyMap() { Map<String, String> map = Maps.newHashMap(); return map; }
From source file:com.noorq.casser.support.Transformers.java
public static <X, Y, K, V> Map<X, Y> transformMap(Map<K, V> inputMap, Function<K, X> funcKey, Function<V, Y> funcValue) { Map<X, Y> map = Maps.newHashMap(); for (Map.Entry<K, V> e : inputMap.entrySet()) { map.put(funcKey.apply(e.getKey()), funcValue.apply(e.getValue())); }// www. j a va2 s . co m return map; }
From source file:com.naver.timetable.dao.ConfigDAO.java
public int isExistSeason(String year, String season) { Map<String, String> parameterMap = Maps.newHashMap(); parameterMap.put("year", year); parameterMap.put("season", season); return (Integer) hufsCubrid.queryForObject("isExistSeason", parameterMap); }