/** * @return a HashMap<String, VirtualHostService> that throws an exception when you put in the same key twice */ public static HashMap<String, MutableVirtualHost> virtualHostHashMap(){ return new DuplicateKeyNotAllowedHashMap<>(); }
@Override public V put(K key, V value) { V prev = get(key); if (prev != null) { throw new IllegalArgumentException("DuplicateKeyNotAllowedHashMap is not allowed to have duplicate keys: The key '"+key+"' is already present"); } return super.put(key, value); }
/** * @return a HashMap<String, VirtualHostService> that throws an exception when you put in the same key twice */ public final static HashMap<String, VirtualHostService> virtualHostHashMap(){ return new DuplicateKeyNotAllowedHashMap<String, VirtualHostService>(); }
aliasTypeMap = new DuplicateKeyNotAllowedHashMap<>(); mountByGroupAliasAndType.put(hostGroup, aliasTypeMap);