@Override public V get(K key) { return mapCache.get(key); }
@Override public List<K> getKeys(V value) { final List<K> listOfKey = reverseCache.get(value); if (listOfKey == null) { return Collections.emptyList(); } return listOfKey; }
@Override public V getIfPresent(K key) { V value = cache.get(key); if (value == null) { missCount.getAndIncrement(); } else { hitCount.getAndIncrement(); } return value; }
@Override public V get(K key, final Callable<? extends V> valueLoader) { synchronized (key) { V value = cache.get(key); if (value != null) { return value; } try { value = valueLoader.call(); cache.put(key, value); return value; } catch (Exception e) { throw new ISE(e, "got an exception while loading key [%s]", key); } } }
@Override public String get(Object key) { return this.hashMap.get(key); }
/** * Fetches item from the cache and marks it as the most recently used. * * @param key - The identifiable key * @return Returns the object from cache */ protected CacheObject getFromCache(Object key){ return this.cache.get(key); }
/** * Fetches item from the cache and marks it as the most recently used. * * @param key - The identifiable key * @return Returns the object from cache */ protected CacheObject getFromCache(Object key){ return this.cache.get(key); }
/** * Retrieves container for a given object {@link Id}. * * @param id the {@link Id} of the contained object * * @return a {@link ContainerInfo} descriptor that contains element's container information */ public ContainerInfo containerFor(Id id) { return containersMap.get(id); }
/** * Retrieves the metaclass ({@link EClass}) of the element with the given {@link Id}. * * @param id the {@link Id} of the element * * @return a {@link ClassInfo} descriptor containing element's metaclass information ({@link EClass}, meta-model * name, and {@code nsURI}) */ public ClassInfo metaclassFor(Id id) { return instanceOfMap.get(id); }
private synchronized void updateEmpty(String key) { if (_map.get(key) == null) { _map.put(key, new ArrayList<IMessage>()); } } }
public Long findOpenTreeTaxonIdFor(String externalId) { if (map == null) { build(); } return map.get(externalId); }
public double[] getVector(String s) { s = s.toLowerCase(); if (vectors.containsKey(s)) { // System.out.println(s); // System.out.println(vectors.get(s)); return vectors.get(s); } // System.out.println(vectors.get(unknown)+" "+s); // return vectors.get(unknown); return null; }
public synchronized boolean isEmpty(String key) { updateEmpty(key); return _map.get(key).isEmpty(); }
public synchronized ArrayList<IMessage> get(String key) { updateEmpty(key); return _map.get(key); }
private synchronized void updateEmpty(String key) { if (_map.get(key) == null) { _map.put(key, new ArrayList<IMessage>()); } } }
@Override public Object get(Object key) { Object value = hTreeMap.get(key); if (value != null) { cacheStatistics.incHitTimes(); return value; } else { cacheStatistics.incAccessTimes(); return null; } }
private Batch getOrCreate(Long key) { Batch batch = pointMap.get(key); if (batch == null) { batch = new Batch(); } batch.setKey(key); return batch; }
public synchronized void put(IMessage message) { // no need to handle broadcast messages if (message.getNodeEui().equalsIgnoreCase(IMessage.NODE_BROADCAST_ID)) { return; } updateEmpty(message.getNodeEui()); ArrayList<IMessage> _queue = _map.get(message.getNodeEui()); _queue.add(message); _logger.debug("Adding [key:{}, size:{}, {}] in to the map", message.getNodeEui(), _queue.size(), message); }
public boolean isObjectBinary(@Nullable GitFilter filter, @Nullable GitObject<? extends ObjectId> objectId) throws IOException, SVNException { if (objectId == null || filter == null) return false; final String key = filter.getName() + " " + objectId.getObject().name(); Boolean result = binaryCache.get(key); if (result == null) { try (InputStream stream = filter.inputStream(objectId)) { result = SVNFileUtil.detectMimeType(stream) != null; } binaryCache.putIfAbsent(key, result); } return result; }
public static FirmwareData getFirmwareDataFromOfflineMap(Integer typeId, Integer versionId) { FirmwareData firmwareData = getFirmwareMap().get(getFirmwareDataOfflineMapName(typeId, versionId)); if (firmwareData == null) { //firmwareData = DaoUtils.getFirmwareDataDao().getByTypeVersion(typeId, versionId); firmwareData = loadFirmwareDataFromDisk(typeId, versionId); if (firmwareData != null) { getFirmwareMap().put(getFirmwareDataOfflineMapName(typeId, versionId), firmwareData); } } return firmwareData; }