/** * Factory for singleton instances by name. * <p> * Only a single instance can exist for each name. * * @param storeName Name for the singleton instance * * @return The singleton instance for the given name */ public static synchronized MapStore getInstance(String storeName) { MapStore mapStore = MAP_STORES.get(storeName); if (mapStore == null) { mapStore = new MapStore(); MAP_STORES.put(storeName, mapStore); } return mapStore; }
@Override public Map<String, String> putAll(@NotNull Map<String, String> entries) { if (entries == null) { throw new IllegalArgumentException("Cannot set null entries"); } Map<String, String> oldValues = new HashMap<>(entries.size()); for (String key : entries.keySet()) { String oldValue = put(key, entries.get(key)); oldValues.put(key, oldValue); } return oldValues; } }