List of usage examples for com.google.common.collect MapMaker MapMaker
public MapMaker()
From source file:de.rwhq.serializer.StringCutSerializer.java
public static StringCutSerializer get(final Integer size) { if (cache == null) { cache = new MapMaker().weakValues().makeMap(); } else if (cache.containsKey(size)) { return cache.get(size); }//ww w . j a v a 2s .c o m final StringCutSerializer s = new StringCutSerializer(size); cache.put(size, s); return s; }
From source file:com.navercorp.pinpoint.profiler.util.Maps.java
private static MapMaker createWeakMapMaker() { final MapMaker mapMaker = new MapMaker(); mapMaker.weakKeys(); return mapMaker; }
From source file:sg.atom.utils._commons.bean.orika.util.HashMapUtility.java
/** * Generates a new instance of ConcurrentMap with the specified max weighted * capacity//w ww. ja v a 2 s. c o m * * @param keyClass * @param valClass * @param capacity * @return a new instance of ConcurrentMap with the specified max weighted * capacity */ public static <K, V extends MappedTypePair<Object, Object>> ConcurrentMap<K, V> getConcurrentMap(int capacity) { MapMaker builder = new MapMaker(); return builder.concurrencyLevel(capacity).makeMap(); }
From source file:nl.tue.gale.common.cache.Caches.java
public static <T> Cache<T> newFixedCache(int maxSize) { Cache<T> result = new ComputingMapCache<T>(new MapMaker().maximumSize(maxSize).<URI, T>makeMap(), null, null);// ww w . j a v a2 s . c om return result; }
From source file:nl.tue.gale.common.cache.Caches.java
public static <T> Cache<T> newCache(int maxSize) { Cache<T> result = new ComputingMapCache<T>( new MapMaker().maximumSize(maxSize).softValues().<URI, T>makeMap(), null, null); return result; }
From source file:com.mac.holdempoker.socket.SocketManager.java
public SocketManager() { connections = new MapMaker().makeMap(); cache = Queues.newConcurrentLinkedQueue(); }
From source file:com.opengamma.util.map.HashDeepMap2.java
protected MapMaker mapMaker() { return new MapMaker(); }
From source file:de.rwhq.io.rm.ReferenceCachedResourceManager.java
ReferenceCachedResourceManager(ResourceManager rm) { this.rm = rm; this.map = new MapMaker().weakValues().makeMap(); }
From source file:com.zimbra.common.util.MapUtil.java
/** * Returns a new {@code Map} that maps a key to a {@code List} of values. * When {@code get()} is called on a key that does not exist in the map, * the map implicitly creates a new key that maps to an empty {@code List}. *//*from w ww .j a v a2s.c o m*/ public static <K, V> ConcurrentMap<K, List<V>> newValueListMap() { Function<K, List<V>> listCreator = new Function<K, List<V>>() { @Override public List<V> apply(K from) { return new ArrayList<V>(); } }; return new MapMaker().makeComputingMap(listCreator); }
From source file:com.facebook.buck.dalvik.DalvikStatsCache.java
DalvikStatsCache() {
cache = new MapMaker().weakKeys().makeMap();
}