Code example for HashMap

Methods: containsKey, put

0
	 
	private final HashMap<String, RequestProcessor> _processors = new HashMap<String, RequestProcessor>();
	 
	public void register(String commandName, RequestProcessor processor) throws ProcessorRegistrationConflictException
	{ 
		if (_processors.containsKey(commandName))
		{ 
			throw new ProcessorRegistrationConflictException(commandName);
		} 
		 
		_processors.put(commandName, processor);
	} 
	 
	public void reregister(String commandName, RequestProcessor processor) throws ProcessorRegistrationConflictException
    { 
        if (_processors.containsKey(commandName))
        { 
            unregister(commandName);
        } 
         
        _processors.put(commandName, processor);